user www www;
worker_processes auto;
worker_cpu_affinity auto;
error_log /home/wwwlogs/nginx_error.log crit;
pid /usr/local/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200;
events {
use epoll;
worker_connections 51200;
multi_accept off;
accept_mutex off;
}
http {
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 100m;
client_body_buffer_size 32k;
sendfile on;
sendfile_max_chunk 512k;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
server_tokens off;
log_format logf '[$time_local] $remote_addr "$request" $status $body_bytes_sent $request_body "$http_referer" "$http_user_agent"';
access_log /package/log/access.log logf;
include vhost/*.conf;
}
http {
log_format main_json escape=json '{'
'"time_local": "$time_local", '
'"remote_addr": "$remote_addr", '
'"status": "$status", '
'"http_host": "$http_host", '
'"request_method": "$request_method", '
'"request_uri": "$request_uri", '
'"request_body": "$request_body", '
'"request_length": "$request_length", '
'"body_bytes_sent": "$body_bytes_sent", '
'"bytes_sent": "$bytes_sent", '
'"http_referer": "$http_referer", '
'"http_user_agent": "$http_user_agent", '
'"http_x_forwarded_for": "$http_x_forwarded_for", '
'"request_time": "$request_time", '
'"upstream_response_time": "$upstream_response_time", '
'"upstream_response_length": "$upstream_response_length", '
'"ssl_protocol": "$ssl_protocol", '
'"ssl_cipher": "$ssl_cipher", '
'"scheme": "$scheme", '
'"server_protocol": "$server_protocol", '
'"gzip_ratio": "$gzip_ratio"'
'}';
access_log /package/access.json main_json;
log_format logf '[$time_local] "$remote_addr" "$host" "$request" '
'$status $body_bytes_sent $request_body "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /package/access.log logf;
}
stream {
server {
listen 322;
proxy_pass 192.168.1.188:22;
}
}
server {
listen 80;
server_name *.netnr.com;
return 301 https://$host$request_uri;
}
server {
listen 8080 ssl http2;
listen [::]:8080 ssl http2;
server_name *.netnr.com;
error_page 497 https://$host$request_uri;
error_page 497 =301 https://$host$request_uri;
error_page 497 =307 https://$host$request_uri;
}
location = /path/api/list_post {
proxy_method GET;
proxy_pass http://192.168.7.13:713$request_uri;
}
server {
listen 80;
server_name netnr.com;
rewrite ^(.*) $scheme://www.$host$1 permanent;
}
server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
server_name netnr.com;
ssl_certificate /package/ssl/netnr.com/fullchain.cer;
ssl_certificate_key /package/ssl/netnr.com/private.key;
}
server {
ssl_certificate /package/ssl/netnr.com/fullchain.cer;
ssl_certificate_key /package/ssl/netnr.com/private.key;
ssl_session_timeout 60m;
ssl_session_cache shared:SSL:10m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers on;
}
server {
proxy_intercept_errors on;
error_page 403 404 408 413 414 /404.html;
location /404.html {
root html;
}
error_page 500 501 503 504 /503.html;
location /503.html {
root html;
}
}
server {
location /nginx_status {
stub_status on;
access_log off;
}
}
upstream lb-web {
server 192.168.5.100:8080 weight=1 max_fails=2 fail_timeout=20s;
server 192.168.5.101:8080 weight=2 max_fails=2 fail_timeout=20s;
}
location / {
proxy_pass http://lb-web;
proxy_next_upstream error timeout http_500 http_502 http_503 http_504;
proxy_next_upstream_tries 3;
}
location / {
proxy_buffering on;
proxy_buffer_size 4k;
proxy_buffers 8 1M;
proxy_busy_buffers_size 2M;
proxy_max_temp_file_size 0;
proxy_request_buffering off;
client_max_body_size 0;
}
location / {
proxy_redirect http://$host/ http://$http_host/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Cookie $http_cookie;
}
location / {
proxy_hide_header Access-Control-Allow-Origin;
add_header Access-Control-Allow-Origin '*' always;
add_header Access-Control-Allow-Methods 'GET,POST,PUT,DELETE,PATCH,OPTIONS' always;
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization' always;
}
location /ftp/ {
alias /package/;
index _index.html;
autoindex on;
autoindex_exact_size off;
autoindex_localtime off;
}
location / {
root /package/site/www;
try_files $uri $uri/ /index.html?$args;
}
location /third-party/getip {
resolver 114.114.114.114;
proxy_pass https://www.taobao.com/help/getip.php;
proxy_ssl_verify off;
}
location / {
if ( $request_uri = "/" ) {
rewrite ^(.*)$ /$1/index.html last;
}
if (!-e $request_filename) {
rewrite ^(.*)$ /$1.html last;
break;
}
}
location / {
proxy_pass https://10.0.0.5:9951;
proxy_ssl_certificate /package/ssl/local/server.crt;
proxy_ssl_certificate_key /package/ssl/local/server.key;
proxy_ssl_verify off;
proxy_ssl_session_reuse on;
}
server {
listen 80 default_server;
listen 443 ssl default_server;
listen [::]:80 default_server;
listen [::]:443 default_server;
server_name _;
charset utf-8;
ssl_certificate /package/ssl/netnr.com/fullchain.cer;
ssl_certificate_key /package/ssl/netnr.com/private.key;
return 500 "Visit https://www.netnr.com";
}
server {
if ($request_method ~ ^(HEAD)$ ) {
return 404;
}
location / {
if ($http_cookie !~ 'access_token') {
return 401;
}
if ($remote_addr !~ ^(192.168.1.11|123.123.123.123)) {
return 403 "No Access $remote_addr\n";
}
if ($http_x_forwarded_for !~ ^(192.168.100.100)) {
return 403 "No Access $http_x_forwarded_for\n";
}
}
}
server {
allow 192.168.100.100;
deny all;
}
location / {
allow 192.168.100.100;
deny all;
}
geo $not_allowed {
192.168.100.100 0;
default 1;
}
server {
location / {
if ($not_allowed) {
return 403 "No Access $remote_addr\n";
}
}
}
location /404 {
add_header Content-Type text/html;
return 404 '<!DOCTYPE html><html><head><title>404</title></head><body><h1>404</h1></body></html>';
}
location /ip {
add_header Access-Control-Allow-Origin '*' always;
add_header X-Forwarded-List $http_x_forwarded_for;
add_header X-real-IP $remote_addr;
default_type text/plain;
return 200 "$remote_addr\n";
}
location ~* @ {
root /data/mirror_unpkg;
proxy_store on;
proxy_temp_path cache_temp;
proxy_store_access user:rw group:rw all:r;
proxy_set_header Accept-Encoding '';
proxy_set_header x-real-ip $remote_addr;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
if (!-e $request_filename) {
proxy_pass https://unpkg.com;
}
}
server {
listen 443 ssl http2;
listen 443 ssl;
http2 on;
}
server {
listen 443 ssl http2;
server_name www.netnr.com;
charset utf-8;
ssl_certificate /package/ssl/netnr.com/fullchain.cer;
ssl_certificate_key /package/ssl/netnr.com/private.key;
ssl_session_timeout 60m;
ssl_session_cache shared:SSL:10m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers on;
location /nginx_status {
stub_status on;
access_log off;
}
location / {
proxy_hide_header Access-Control-Allow-Origin;
add_header Access-Control-Allow-Origin '*' always;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS' always;
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,tenant-id' always;
proxy_redirect http://$host/ http://$http_host/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Cookie $http_cookie;
proxy_pass http://localhost:51;
if (!-e $request_filename) {
rewrite ^(.*)$ /$1.html last;
break;
}
}
}