【问题标题】:Gunicorn + Supervisor configuration issue. Django project deployed on amazon ec2 + ubuntu + nginxGunicorn + Supervisor 配置问题。 Django项目部署在amazon ec2 + ubuntu + nginx
【发布时间】:2015-10-18 12:15:19
【问题描述】:

我一直在使用 gunicorn 和 nginx 在 ubuntu ec2 实例上运行 django 项目。我知道它至少运行了几天没有问题,但我只是在部署一周后检查了它,它不再运行。我在访问该站点时收到 502 Bad Gateway 错误。我输入了我通常的 gunicorn 命令, sudo gunicorn adventure_time.wsgi:application –b 127.0.0.1:8001 但我得到的只是

[2015-07-28 05:14:47 +0000] [11164] [INFO] Starting gunicorn 19.3.0
[2015-07-28 05:14:47 +0000] [11164] [ERROR] Connection in use: ('127.0.0.1', 8000)
[2015-07-28 05:14:47 +0000] [11164] [ERROR] Retrying in 1 second.
[2015-07-28 05:14:48 +0000] [11164] [ERROR] Connection in use: ('127.0.0.1', 8000)
[2015-07-28 05:14:48 +0000] [11164] [ERROR] Retrying in 1 second.
[2015-07-28 05:14:49 +0000] [11164] [ERROR] Connection in use: ('127.0.0.1', 8000)
[2015-07-28 05:14:49 +0000] [11164] [ERROR] Retrying in 1 second.
[2015-07-28 05:14:50 +0000] [11164] [ERROR] Connection in use: ('127.0.0.1', 8000)
[2015-07-28 05:14:50 +0000] [11164] [ERROR] Retrying in 1 second.
[2015-07-28 05:14:51 +0000] [11164] [ERROR] Connection in use: ('127.0.0.1', 8000)
[2015-07-28 05:14:51 +0000] [11164] [ERROR] Retrying in 1 second.
[2015-07-28 05:14:52 +0000] [11164] [ERROR] Can't connect to ('127.0.0.1', 8000)

netstat -tulpn 给我看这个:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:8000          0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      11126/nginx: worker
tcp6       0      0 :::22                   :::*                    LISTEN      -
udp        0      0 0.0.0.0:68              0.0.0.0:*                           -
udp        0      0 0.0.0.0:30444           0.0.0.0:*                           -
udp6       0      0 :::63162                :::*                                -

所以... 127.0.0.1:8000 上似乎没有运行任何东西。我没有什么可杀的。 (我也试过sudo pkill gunicorn)有人知道我可以做些什么来让我的网站再次运行吗?另外,为什么gunicorn仍在尝试连接到端口8000,但在我的命令中我要求它连接到8001?谢谢!!

edit:我认为这不仅仅是 gunicorn。我也是主管,我觉得这可能是问题的一部分。

我的项目文件夹里面是gunicorn.conf.py

proc_name = "at_api"
bind = '127.0.0.1:8001'
loglevel = "error"
workers = 2

在我的/etc/supervisor/conf.d/at_api.conf里面

[group:at_api]
programs=gunicorn_at_api

[program:gunicorn_at_api]
command=/home/ubuntu/.virtualenvs/adventure_time/bin/gunicorn -c gunicorn.conf.py -p gunicorn.pid wsgi:app\
lication --pythonpath directory=/home/ubuntu/at_api
user=ubuntu
autostart=true
autorestart=true
redirect_stderr=true

【问题讨论】:

    标签: django amazon-web-services nginx amazon-ec2 gunicorn


    【解决方案1】:

    你试过重启吗?可能是一些旧的/ghost gunicorn 进程导致了这种情况。

    【讨论】:

      猜你喜欢
      • 2020-12-26
      • 1970-01-01
      • 2020-09-01
      • 2014-03-31
      • 2013-12-08
      • 2013-10-05
      • 2018-11-27
      • 2015-04-21
      • 2015-04-17
      相关资源
      最近更新 更多