nginx + 多tomcat 配置多域名

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/cmbc_ceo/article/details/52371534

我原来是这么配置的

upstream web.xxx.com  {
         sticky;
         server 192.168.1.171:8080 max_fails=1 fail_timeout=10s;
         server 192.168.1.175:8080 max_fails=1 fail_timeout=10s;
    }
       

   server {
        listen       80;
        server_name  web.xxx.com;

        location / {
                proxy_pass http://web.xxx.com/;

                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_connect_timeout   1;
                proxy_read_timeout      30;
        }


        location /img {
                root /usr/local/www/nginx;
                proxy_connect_timeout   1;
                proxy_read_timeout      10;
        }

        rewrite ^(.*)\;jsessionid=(.*)$ $1 break;

        underscores_in_headers on;
}


 现在 我新加了个server

 

server {
        listen       80;
        server_name  store.xxx.com;

        location / {
                proxy_pass http://192.168.1.171:8080/store/;
                proxy_redirect off;
                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_connect_timeout   1;
                proxy_read_timeout      30;        }

        location /img {
                root /usr/local/www/nginx;
                proxy_connect_timeout   1;
                proxy_read_timeout      10;
        }
             rewrite ^(.*)\;jsessionid=(.*)$ $1 break;

        underscores_in_headers on;
}
     

展开阅读全文

没有更多推荐了,返回首页