如果未部署或停止Webapp,Nginx分配负载

时间:2018-09-11 11:14:27

标签: nginx

Tomcat配置: 在上下文路径/ test,/ prod,/ dev,/ home

上部署了多个webapp

Nginx配置:

  server {
    listen 80;
    server_name www.maketest.com;
    access_log /var/log/nginx/maketest.proxy.log upstreamlog;
    root http://tomcat_servers/dev/;




   location ^~ /dev/ {
      proxy_set_header        X-Forwarded-Host $host;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For 
      $proxy_add_x_forwarded_for;
      proxy_set_header        X-Forwarded-Proto $scheme;
      proxy_pass              http://tomcat_servers/dev/;
      proxy_set_header        Host maketest.com;
      proxy_redirect          off;
      proxy_intercept_errors on;
    }
}

Nginx将负载分配给所有tomcat实例,但是如果webapp关闭,则会出现404 Tomcat错误

0 个答案:

没有答案