/export/servers/nginx/conf/domains/ test1.jd.local
upstream tomcat_live1 {
server 127.0.0.1:1601 weight=10 max_fails=2 fail_timeout=30s ;
}
server {
listen 80;
server_name nihao.local nihao.com 127.0.0.1;
access_log /export/servers/nginx/logs/test1.jd.local/test1.jd.local_access.log main;
error_log /export/servers/nginx/logs/test1.jd.local/test1.jd.local_error.log warn;
error_page 411 = @my_error;
location @my_error {
}
root /export/Packages/vd-live-web/latest/;
location / {
add_header Access-Control-Allow-Origin $http_origin;
add_header Access-Control-Allow-Methods ‘GET, POST, OPTIONS‘;
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‘;
add_header Access-Control-Allow-Credentials true;
proxy_next_upstream http_500 http_502 http_503 http_504 error timeout invalid_header;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://tomcat_live1;
include /export/servers/nginx/conf/error/error_location.conf;
expires 0;
}
location ~ ^/(monitor|resources)/* {
proxy_pass http://127.0.0.1:1601;
include /export/servers/nginx/conf/error/error_location.conf;
}
location /logs/ {
autoindex off;
deny all;
}
location /l/uploadCoverPC {
log_not_found off;
}
include /export/servers/nginx/conf/error/error.conf;
}
原文地址:https://www.cnblogs.com/Rnan/p/11648038.html