Nginx - sometimes throws 502 Bad Gateway

夙愿已清 提交于 2019-12-24 14:52:05

问题


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:


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



来源:https://stackoverflow.com/questions/36856422/nginx-sometimes-throws-502-bad-gateway

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!