nginx 80端口同时监听两个flask项目端口配置
2021-04-12 本文已影响0人
玖月初识
/etc/nginx/conf.d 文件夹下新建 main.conf (文件名随意)
# main.conf
server {
listen 80;
server_name main;
location /equipment {
proxy_pass http://127.0.0.1:7788;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
# 加载图片文件
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|svg)$
{
proxy_pass http://127.0.0.1:7788;
}
# 加载静态 js 和 css 文件
location ~ .*\.(js|css)?$
{
proxy_pass http://127.0.0.1:7788;
}
location /LajiClassify {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}