nginx 80端口同时监听两个flask项目端口配置

/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;
    }
}

你可能感兴趣的:(nginx 80端口同时监听两个flask项目端口配置)