使用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 (将#修改为@)