我是靠谱客的博主 落后冬瓜,这篇文章主要介绍用nginx的location配置多个web工程,现在分享给大家,希望可以做个参考。

在小作坊的实际生产中,由于服务器的紧缺,往往只有一台nginx,一个端口,但又需要我们在nginx里面配置多个web前端工程。

我们就需要用到nginx的location进行代理。

下面是配多个静态工程:

        location / {
            root   /app/nginx/frontier/dist;
            index  index.html ;
            add_header X-Frame-Options SAMEORIGIN ;
        }

        location /gongchengA/ {
            alias   /app/nginx/frontier/gongchengA/;
            index  index.html ;
            add_header X-Frame-Options SAMEORIGIN ;
        }
        location /gongchengB/ {
            alias   /app/nginx/frontier/gongchengB/;
            index  index.html ;
            add_header X-Frame-Options SAMEORIGIN ;
        }

 

location也可以配置多个代理

        location / {
            root   /app/nginx/frontier/dist;
            index  index.html ;
            add_header X-Frame-Options SAMEORIGIN ;
        }

        location /gongchengA/ {
            alias   /app/nginx/frontier/gongchengA/;
            index  index.html ;
            add_header X-Frame-Options SAMEORIGIN ;
        }
        location /gongchengB/ {
            alias   /app/nginx/frontier/gongchengB/;
            index  index.html ;
            add_header X-Frame-Options SAMEORIGIN ;
        }

 

最后

以上就是落后冬瓜最近收集整理的关于用nginx的location配置多个web工程的全部内容,更多相关用nginx内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(113)

评论列表共有 0 条评论

立即
投稿
返回
顶部