Nginx(二)——反向代理服务器部署

Nginx(二)——反向代理服务器部署

upstream tomcat_app{
       server 192.168.94.135:8080 weight=2;
       server 192.168.94.135:9090 weight=3;
}
 

server {

        location / {
            root   html;
            index  index.html index.htm;
            proxy_next_upstream http_502 http_504 error timeout invalid_header;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass  http://tomcat_app;
        }
}

 

proxy_pass斜杠注意事项

location /html/ {
   proxy_pass http://tomcat_app;
}

http://ip:port/html/test.jsp,被nginx代理后,路径http://proxy_pass/html/test.jsp


location /html/ {
   proxy_pass http://tomcat_app/;
}

http://ip:port/html/test.jsp,被nginx代理后,路径http://proxy_pass/test.jsp

相关文章:

  • 2022-12-23
  • 2022-02-17
  • 2021-07-02
  • 2022-12-23
  • 2021-10-29
  • 2021-05-05
  • 2022-12-23
猜你喜欢
  • 2022-01-01
  • 2021-09-25
  • 2021-12-16
  • 2021-08-30
相关资源
相似解决方案