小编use*_*118的帖子

gunicorn + django + nginx unix://socket failed (11: 资源暂时不可用)

在这些配置了 django、gunicorn、supervisor 和 nginx 的服务器上运行非常高的流量。但很多时候我往往会看到 502 错误。所以我检查了 nginx 日志以查看什么错误,这是记录的内容:

[错误] 2388#0:*208027 connect() to unix:/tmp/gunicorn-ourapp.socket 在连接到上游时失败(11:资源暂时不可用)

任何人都可以帮助调试可能导致这种情况发生的原因吗?

这是我们的 nginx 配置:

sendfile on;
tcp_nopush on;
tcp_nodelay off;

listen 80 default_server;
server_name imp.ourapp.com;
access_log /mnt/ebs/nginx-log/ourapp-access.log;
error_log /mnt/ebs/nginx-log/ourapp-error.log;

charset utf-8;
keepalive_timeout 60;
client_max_body_size 8m;

gzip_types text/plain text/xml text/css application/javascript application/x-javascript application/json;

location / {
    proxy_pass http://unix:/tmp/gunicorn-ourapp.socket;
    proxy_pass_request_headers on;
    proxy_read_timeout 600s;
    proxy_connect_timeout 600s;
    proxy_redirect http://localhost/ http://imp.ourapp.com/;
    #proxy_set_header Host              $host;
    #proxy_set_header X-Real-IP         $remote_addr;
    #proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
    #proxy_set_header X-Forwarded-Proto $my_scheme;
    #proxy_set_header X-Forwarded-Ssl   $my_ssl;
}
Run Code Online (Sandbox Code Playgroud)

我们已经将 Django 配置为在 …

linux nginx django wsgi gunicorn

8
推荐指数
1
解决办法
8449
查看次数

标签 统计

django ×1

gunicorn ×1

linux ×1

nginx ×1

wsgi ×1