Nginx代理转发tomcat服务器报错404
1.检查nginx.conf配置 upstream tomcat_lb{ server 192.168.37.121:8081; server 192.168.37.121:8082; } server { listen 80; server_name _; location /{ root html; index index.jps index.htm; proxy_pass http://tomcat_lb; } }} 2.发现服务池里的名字有个_,删除即可 upstream tomcatlb{ server 192.168.37.121:8081; server 192.168.37.121:8082; } server { listen 80; server_name _; location /{ root html; index index.jps index.htm; proxy_pass http://tomcatlb; } } 3.重新启动nginx [root@nginx-server nginx]# nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is oknginx: configuration file /etc/nginx/nginx.conf test is successful[root@nginx-server nginx]# nginx -s reload 4.再次访问
解决问题