Flask应用部署时,Nginx配置遇到哪些常见问题?

2026-06-09 02:411阅读0评论SEO资讯
  • 内容介绍
  • 相关推荐

本文共计198个文字,预计阅读时间需要1分钟。

Flask应用部署时,Nginx配置遇到哪些常见问题?

Nginx配置示例:server { listen 80; server_name 23.145.145.241; # VPS的IP,随意填写 charset utf-8; access_log /var/log/nginx/mysite.access.log main; error_log /var/log/nginx/mysite.error.log;}

Nginx的配置:

Nginx 的配置:

123456789101112131415161718server { listen 80; server_name 23.145.145.241(vps的ip,我随便写的);charset    utf-8;access_log    /var/log/nginx/mysite.access.log    main;error_log    /var/log/nginx/mysite.error.log    warn;location / {    root    /var/www/mysite;    index    index.html index.htm;    include uwsgi_params;    uwsgi_pass    127.0.0.1:5000;    uwsgi_param UWSGI_PYHOME    /var/www/mysite_venv;    uwsgi_param UWSGI_CHDIR    /var/www/mysite;    uwsgi_param PYTHONPATH    /var/www/mystie;    uwsgi_param UWSGI_MODULE    run;    uwsgi_param UWSGI_CALLABLE app;}}

地址栏输入ip, 访问成功!

问题是:把上面的server_name换成域名,其他不变,再访问就提示“If you see this page, the nginx web server is successfully installed and working. Further configuration is required.”域名:阿里云买的vps:搬瓦工这该怎么解决呀?

Flask应用部署时,Nginx配置遇到哪些常见问题?

本文共计198个文字,预计阅读时间需要1分钟。

Flask应用部署时,Nginx配置遇到哪些常见问题?

Nginx配置示例:server { listen 80; server_name 23.145.145.241; # VPS的IP,随意填写 charset utf-8; access_log /var/log/nginx/mysite.access.log main; error_log /var/log/nginx/mysite.error.log;}

Nginx的配置:

Nginx 的配置:

123456789101112131415161718server { listen 80; server_name 23.145.145.241(vps的ip,我随便写的);charset    utf-8;access_log    /var/log/nginx/mysite.access.log    main;error_log    /var/log/nginx/mysite.error.log    warn;location / {    root    /var/www/mysite;    index    index.html index.htm;    include uwsgi_params;    uwsgi_pass    127.0.0.1:5000;    uwsgi_param UWSGI_PYHOME    /var/www/mysite_venv;    uwsgi_param UWSGI_CHDIR    /var/www/mysite;    uwsgi_param PYTHONPATH    /var/www/mystie;    uwsgi_param UWSGI_MODULE    run;    uwsgi_param UWSGI_CALLABLE app;}}

地址栏输入ip, 访问成功!

问题是:把上面的server_name换成域名,其他不变,再访问就提示“If you see this page, the nginx web server is successfully installed and working. Further configuration is required.”域名:阿里云买的vps:搬瓦工这该怎么解决呀?

Flask应用部署时,Nginx配置遇到哪些常见问题?