nginx浏览目录

时间:2022-05-19 14:31:38
[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: weight= max_fails= fail_timeout=30s;
}
server
{
listen ;
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 = @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 ;
     proxy_pass              http://tomcat_web.jd; //去掉这句!!
autoindex on;
}
location /logs/ {
autoindex off;
deny all;
}
}

这样就能通过 http://web.jd.com/product/try/1.0.0/html/ 访问了