您的位置:首页 > 运维架构 > Nginx

nginx配置代理转发,使得一个端口支持多个项目配置

2017-04-25 21:22 507 查看
由于在项目中需要一个外网端口支持一个maven仓库一个tomcat,但是只有一个端口,没有办法,只能通过nginx代理实现

现在提供nginx的配置如下

server {

        listen       8081;

        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {

            root   html;

            index  index.html index.htm;

        }

      #匹配以nexus的路径跳转maven仓库

        location /nexus {

            proxy_pass http://127.0.0.1:8082/nexus;
        }

        #会跳转 tomcat容器

        location /xxx {

            proxy_pass http://127.0.0.1:8083;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html

        #

        error_page   500 502 503 504  /50x.html;

        location = /50x.html {

            root   html;

        }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: