Reputation: 116
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!
Upvotes: 1
Views: 3895
Reputation: 1171
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
Upvotes: 3