首页 > 编程知识 正文

nginx反向代理报403,nginx访问报404

时间:2023-05-05 22:19:31 阅读:158917 作者:3442

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.再次访问


解决问题

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。