Nginx

 nginx1.18

   配置文件 

 

#user root;
worker_processes auto;
#worker_cpu_affinity auto;

error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" $upstream_addr';
access_log off;
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65s;
types_hash_max_size 2048;
#gzip on;
#gzip_disable "MSIE [1-6].";
client_header_buffer_size 512k;
large_client_header_buffers 4 512k;
client_max_body_size 100M;
map $http_user_agent $samesite_none {
default "";
"~Chrom[^ \/]+\/8[\d][\.\d]*" "; httponly; secure; SameSite=none";
}

upstream 47.93.45.142 {
server localhost:8071 max_fails=15 fail_timeout=300s;

#<---------------ngx_healthcheck_module--------------->#
#check interval=2000 rise=5 fall=10 timeout=10000 type=http;
#check_http_send "GET /webroot/decision/system/health HTTP/1.0\r\n\r\n";
#check_http_expect_alive http_2xx http_3xx;
#<---------------ngx_healthcheck_module--------------->#
}
upstream mainweb {
server localhost:80 max_fails=15 fail_timeout=300s;

#<---------------ngx_healthcheck_module--------------->#
#check interval=2000 rise=5 fall=10 timeout=10000 type=http;
#check_http_send "GET /webroot/decision/system/health HTTP/1.0\r\n\r\n";
#check_http_expect_alive http_2xx http_3xx;
#<---------------ngx_healthcheck_module--------------->#
}

server {
listen 8094;
server_name 47.93.45.142;
underscores_in_headers on;
#charset koi8-r;
#access_log logs/host.access.log main;

#<---------------Nginx upstream status monitor--------------->#
#location /status {
# healthcheck_status html;
#}
#<---------------Nginx upstream status monitor--------------->#
location /webroot/ {
proxy_http_version 1.1;
proxy_pass http://47.93.45.142;
proxy_next_upstream http_500 http_502 http_503 http_504 http_403 http_404 http_429 error timeout invalid_header non_idempotent;
#proxy_next_upstream_timeout 0;
#proxy_next_upstream_tries 0;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Access-Control-Allow-Origin *;
add_header P3P 'policyref="/w3c/p3p.xml", CP="NOI DSP PSAa OUR BUS IND ONL UNI COM NAV INT LOC"';

proxy_set_header Connection "";
#proxy_buffering off;
#proxy_buffer_size 64k;
#proxy_buffers 32 64k;
#proxy_busy_buffers_size 64k;

proxy_connect_timeout 75;
proxy_read_timeout 400;
proxy_send_timeout 400;
#proxy_cookie_path ~^/(.+)$ "/$1; secure; SameSite=none";
#proxy_cookie_path / "/; secure; SameSite=none";
#proxy_cookie_path /uas /uas$samesite_none;
#proxy_cookie_path / /$samesite_none;
}
location / {
proxy_http_version 1.1;
proxy_pass http://mainweb/;
proxy_next_upstream http_500 http_502 http_503 http_504 http_403 http_404 http_429 error timeout invalid_header non_idempotent;
#proxy_next_upstream_timeout 0;
#proxy_next_upstream_tries 0;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Access-Control-Allow-Origin *;
add_header P3P 'policyref="/w3c/p3p.xml", CP="NOI DSP PSAa OUR BUS IND ONL UNI COM NAV INT LOC"';

proxy_set_header Connection "";
#proxy_buffering off;
#proxy_buffer_size 64k;
#proxy_buffers 32 64k;
#proxy_busy_buffers_size 64k;

proxy_connect_timeout 175;
proxy_read_timeout 400;
proxy_send_timeout 400;
#proxy_cookie_path ~^/(.+)$ "/$1; secure; SameSite=none";
#proxy_cookie_path / "/; secure; SameSite=none";
#proxy_cookie_path /uas /uas$samesite_none;
#proxy_cookie_path / /$samesite_none;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

}

 

 

  start nginx.exe

 nginx -s stop

 

posted on 2020-09-29 08:36  developer1980  阅读(92)  评论(0)    收藏  举报

导航