gunicorn + django + nginx - recv()未就绪(11:资源暂时不可用)

问题描述 投票:0回答:1

我收到了这个问题。我正在尝试设置服务器,无法让它运行。我正在使用django,gunicorn和nginx。这是日志

nginx日志

2018/02/09 22:22:32 [debug] 1421#1421: *9 http write filter: l:1 f:0 s:765
2018/02/09 22:22:32 [debug] 1421#1421: *9 http write filter limit 0
2018/02/09 22:22:32 [debug] 1421#1421: *9 writev: 765 of 765
2018/02/09 22:22:32 [debug] 1421#1421: *9 http write filter 0000000000000000
2018/02/09 22:22:32 [debug] 1421#1421: *9 http copy filter: 0 "/?"
2018/02/09 22:22:32 [debug] 1421#1421: *9 http finalize request: 0, "/?" a:1, c:1
2018/02/09 22:22:32 [debug] 1421#1421: *9 set http keepalive handler
2018/02/09 22:22:32 [debug] 1421#1421: *9 http close request
2018/02/09 22:22:32 [debug] 1421#1421: *9 http log handler
2018/02/09 22:22:32 [debug] 1421#1421: *9 free: 000055D4A01ACBE0
2018/02/09 22:22:32 [debug] 1421#1421: *9 free: 000055D4A01C6FB0, unused: 0
2018/02/09 22:22:32 [debug] 1421#1421: *9 free: 000055D4A01B9F80, unused: 214
2018/02/09 22:22:32 [debug] 1421#1421: *9 free: 000055D4A01C9460
2018/02/09 22:22:32 [debug] 1421#1421: *9 hc free: 0000000000000000 0
2018/02/09 22:22:32 [debug] 1421#1421: *9 hc busy: 0000000000000000 0
2018/02/09 22:22:32 [debug] 1421#1421: *9 reusable connection: 1
2018/02/09 22:22:32 [debug] 1421#1421: *9 event timer add: 3: 70000:1518215022208
2018/02/09 22:22:32 [debug] 1421#1421: *9 post event 000055D4A01D8BD0
2018/02/09 22:22:32 [debug] 1421#1421: *9 delete posted event 000055D4A01D8BD0
2018/02/09 22:22:32 [debug] 1421#1421: *9 http keepalive handler
2018/02/09 22:22:32 [debug] 1421#1421: *9 malloc: 000055D4A01C9460:1024
2018/02/09 22:22:32 [debug] 1421#1421: *9 recv: fd:3 -1 of 1024
2018/02/09 22:22:32 [debug] 1421#1421: *9 recv() not ready (11: Resource temporarily unavailable)
2018/02/09 22:22:32 [debug] 1421#1421: *9 free: 000055D4A01C9460

gunicorn日志:

[2018-02-09 22:21:35 +0000] [2514] [INFO] Worker exiting (pid: 2514)
[2018-02-09 22:21:35 +0000] [2510] [INFO] Worker exiting (pid: 2510)
[2018-02-09 22:21:35 +0000] [2523] [INFO] Worker exiting (pid: 2523)
[2018-02-09 22:21:35 +0000] [2501] [INFO] Shutting down: Master
[2018-02-09 22:21:36 +0000] [2556] [INFO] Starting gunicorn 19.7.1
[2018-02-09 22:21:36 +0000] [2556] [INFO] Listening at: unix:/var/www/myapp/application/live.sock (2556)
[2018-02-09 22:21:36 +0000] [2556] [INFO] Using worker: sync
[2018-02-09 22:21:36 +0000] [2563] [INFO] Booting worker with pid: 2563
[2018-02-09 22:22:31 +0000] [2556] [CRITICAL] WORKER TIMEOUT (pid:2563)
[2018-02-09 22:22:32 +0000] [2598] [INFO] Booting worker with pid: 2598

它能是什么?我现在被困了几个小时。

这是我的gunicorn服务:

[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=www-data
Group=www-data
WorkingDirectory={{ app_dir }}
ExecStart={{ virtualenv_dir }}/bin/gunicorn --workers 1 --bind unix:{{ app_dir }}/live.sock {{ wsgi_module }}:application --error-logfile /var/log/gunicorn.log

[Install]
WantedBy=multi-user.target
python django nginx gunicorn
1个回答
1
投票

如果您保持wsgi文件设置为默认值,请尝试以下操作:

{{ project_dir }}.wsgi:application

在你的代码中:

WorkingDirectory={{ project_dir }}
ExecStart={{ virtualenv_dir }}/bin/gunicorn --workers 1 --bind unix:{{ app_dir }}/live.sock {{ project_dir }}.wsgi:application --error-logfile /var/log/gunicorn.log

您正在从您的应用程序目录运行gunicorn,而是从您的项目目录运行它。

© www.soinside.com 2019 - 2024. All rights reserved.