Nginx - sometimes throws 502 Bad Gateway

2019-07-24 08:02发布

I've got a project Django, gunicorn, nginx.

It mostly works (most of the endpoints), but sometimes nginx throws 502 BAD GATEWAY.

Error is upstream prematurely closed connection while reading response header from upstream Do you have any idea what's wrong with it?

Thanks!

1条回答
等我变得足够好
2楼-- · 2019-07-24 08:41

Sometimes it's happen when page render time more longer then expected

Try to increase timeout (nginx has 60s default timeout)

proxy_send_timeout 180s;
proxy_read_timeout 180s;

Read more here http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout

查看更多
登录 后发表回答