NGINX - 连接到UNIX袜子失败

时间:2017-02-21 01:59:22

标签: django nginx gunicorn

此处查看了一些其他类似问题,但无法诊断问题。

我的网站偶尔会出现502 Bad Gateway Error。

我在错误日志中找到了以下内容。注意我使用Gunicorn / NGINX在Ubuntu 16.04上使用VPS服务器。



ListChanged




当我去检查gunicorn状态时,我得到以下内容所以看起来可能是因为某些原因失败了?:



2017/02/21 01:08:29 [crit] 1247#1247: *1 connect() to unix:/home/django/chrisblog/chrisblog.sock failed (2: No such file or directory) while connecting to upstream, client: 173.48.32.62, server: 45.32.201.31, request: "GET /redditclone/ HTTP/1.1", upstream: "http://unix:/home/django/chrisblog/chrisblog.sock:/redditclone/", host: "pythoncreate.com"
2017/02/21 01:10:36 [crit] 1575#1575: *1 connect() to unix:/home/django/chrisblog/chrisblog.sock failed (2: No such file or directory) while connecting to upstream, client: 173.48.32.62, server: 45.32.201.31, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/chrisblog/chrisblog.sock:/", host: "pythoncreate.com"
2017/02/21 01:48:04 [crit] 2342#2342: *2 connect() to unix:/home/django/chrisblog/chrisblog.sock failed (2: No such file or directory) while connecting to upstream, client: 173.48.32.62, server: 45.32.201.31, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/chrisblog/chrisblog.sock:/", host: "pythoncreate.com"




这是ps aux |的输出镜头grep nginx



 gunicorn.service - gunicorn daemon
   Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2017-02-21 01:46:08 UTC; 7min ago
 Main PID: 2245 (code=exited, status=203/EXEC)

Feb 21 01:46:08 mydjangoblog systemd[1]: Started gunicorn daemon.
Feb 21 01:46:08 mydjangoblog systemd[1]: gunicorn.service: Main process exited, code=exited, status=203/EXEC
Feb 21 01:46:08 mydjangoblog systemd[1]: gunicorn.service: Unit entered failed state.
Feb 21 01:46:08 mydjangoblog systemd[1]: gunicorn.service: Failed with result 'exit-code'.




非常感谢任何帮助

1 个答案:

答案 0 :(得分:0)

您只需检查“/home/django/chrisblog/chrisblog.sock”是否存在。