如何解决使用Gunicorn作为服务时重定向到本地主机
我试图在我的Flask应用程序上使用Nginx在服务器上运行Gunicorn作为服务,第一页工作正常,但其他页面重定向到类似“ http:// localhost / e /”的位置。 在终端中运行Gunicorn时,一切正常(无需服务)。 我尝试了以下步骤
-
制成gunicorn.service文件
[Unit] Description=Gunicorn service After=network.target [Service] User=ubuntu Group=www-data WorkingDirectory=/home/ubuntu/xyz ExecStart=/usr/bin/gunicorn3 --workers 3 --bind unix:xyz.sock -m 007 app:app
-
在nginx中制作的flaskapp文件
server{ listen 80; server_name domain_name server_ip; location /{ proxy_pass http://unix:/home/ubuntu/xyz/xyz.sock; }
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。