Ubuntu 将Gunicorn用作服务时,Gunicorn重定向到本地主机

Ubuntu 将Gunicorn用作服务时,Gunicorn重定向到本地主机,ubuntu,nginx,flask,gunicorn,ubuntu-server,Ubuntu,Nginx,Flask,Gunicorn,Ubuntu Server,我正在尝试在我的Flask应用程序上使用Nginx在服务器上运行Gunicorn作为服务,第一个页面工作正常,但其他页面被重定向到类似的位置http://localhost/e/'. 在终端中运行Gunicorn时,一切正常(没有“作为服务”)。 我尝试了以下步骤 已生成gunicorn.service文件 [Unit] Description=Gunicorn service After=network.target [Service] User=ubuntu Gro

我正在尝试在我的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;
          }
    
}

尝试以某种方式使用指令,例如
proxy\u重定向http://localhost/ http://