鱼C论坛

 找回密码
 立即注册
查看: 1166|回复: 0

nginx部署多个flask 求助

[复制链接]
发表于 2022-2-7 16:46:56 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
nginx 部署多个 flask 项目时,   如果直接用IP地址 , 项目能正常的运行;


但是如果是配置域名的话, 就出现了无法访问;   

求各路大神支支招;
下面是nginx配置文件;~!
  1. server {
  2.         listen       9001 default_server;
  3.         listen       [::]:9001 default_server;
  4.         server_name  _;
  5.         root         /usr/share/nginx/html;

  6.         # Load configuration files for the default server block.
  7.         include /etc/nginx/default.d/*.conf;

  8.         location / {
  9.                   proxy_pass http://localhost:9090;
  10.                   proxy_redirect off;

  11.                   proxy_set_header Host $http_post;
  12.                   proxy_set_header X-Real-IP $remote_addr;
  13.                
  14.         }

  15.         error_page 404 /404.html;
  16.             location = /40x.html {
  17.         }

  18.         error_page 500 502 503 504 /50x.html;
  19.             location = /50x.html {
  20.         }
  21.     }
  22.        
  23.        
  24.     server {
  25.         listen       80 default_server;
  26.         listen       [::]:80 default_server;
  27.         server_name  zhl6688.com.cn www.zhl6688.com.cn;
  28.         #server_name  _;
  29.         root         /usr/share/nginx/html;

  30.            return 301 https://zhl6688.com.cn$request_uri;
  31.           
  32.         # Load configuration files for the default server block.
  33.         include /etc/nginx/default.d/*.conf;

  34.         location / {
  35.                   proxy_pass http://localhost:5000;
  36.                   proxy_redirect off;

  37.                   proxy_set_header Host $http_post;
  38.                   proxy_set_header X-Real-IP $remote_addr;
  39.                
  40.         }

  41.         error_page 404 /404.html;
  42.             location = /40x.html {
  43.         }

  44.         error_page 500 502 503 504 /50x.html;
  45.             location = /50x.html {
  46.         }
  47.     }

  48.         server {
  49.         listen       443 ssl;      
  50.         server_name  zhl6688.com.cn www.zhl6688.com.cn;
  51.         root         /home/web/WechatApps;

  52.         ssl_certificate /home/web/WechatApps/ssl/zhl6688.com.cn_bundle.crt;
  53.         ssl_certificate_key /home/web/WechatApps/ssl/zhl6688.com.cn.key;
  54.         
  55.     }       
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-4-30 14:17

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表