nginx简单配置多个域名转向多个tomcat

tomcat的默认端口都是4位,因此访问时必须再链接中加端口,利用nginx可以简单解决这个问题。


nginx.conf配置:

    server {
        listen       80;
        server_name  xx.com.cn;

        location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_pass   http://localhost:8080;
        }

    }

    server {
        listen       80;
        server_name  xx.cn;

        location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_pass   http://localhost:8180;
        }

    }

猜你喜欢

转载自blog.csdn.net/zml_moxueli/article/details/77847905
今日推荐