[root@localhost domains]# vi web.jd.com location / proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; upstream tomcat_web.jd { server 127.0.0.1:8013 weight=10 max_fails=2 fail_timeout=30s; } server { listen 80; server_name web.jd.com web.jd.local; access_log /export/servers/nginx/logs/web.jd.com/web.jd.com_access.log main; error_log /export/servers/nginx/logs/web.jd.com/web.jd.com_error.log warn; chunkin on; error_page 411 = @my_error; location @my_error { chunkin_resume; } root /export/App/web.jd.com/; location / { root /export/App/web.jd.com/; //加上这句!! 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; expires 0;
proxy_pass http://tomcat_web.jd; //去掉这句!! autoindex on; } location /logs/ { autoindex off; deny all; } }
这样就能通过 http://web.jd.com/product/try/1.0.0/html/ 访问了