nginx添加需要代理的域名 配置
dap.cns.360buy.com为需要nginx代理的域名,被代理的端口为:8089,配置需要在${nginx_home}/conf/nginx.conf的文件中加入如下配置即可
upstream dap_cns.360buy.com {
server 127.0.0.1:8089 weight=10 max_fails=2 fail_timeout=30s;
}
server
{
listen 80;
server_name dap.cns.360buy.com;
#access_log /export/servers/nginx/logs/test.jd.com/test.jd.com_access.log main;
#error_log /export/servers/nginx/logs/test.jd.com/test.jd.com_error.log warn;
chunkin on;
error_page 411 = @my_error;
location @my_error {
chunkin_resume;
}
#root /export/App/test.jd.com/;
location / {
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://dap_cns.360buy.com;
expires 0;
}
location /logs/ {
autoindex off;
deny all;
}
}