在小作坊的实际生产中,由于服务器的紧缺,往往只有一台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内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复