502 错误网关 django nginx + gunicorn

502 Bad Gateway django nginx + gunicorn

我正在使用 post 请求将大量数据从用户输入(文本区域)加载到数据库(18k lines) 我得到 502 Bad Gateway 错误

当我打印时 sudo nano /var/log/nginx/error.log 我明白了:

2018/09/06 10:21:04 [alert] 19688#19688: *3 open socket #22 left in connection 4
2018/09/06 10:21:04 [alert] 19688#19688: aborting
2018/09/06 11:04:32 [error] 20076#20076: *14 upstream prematurely closed connection while reading response header from upstream, client: 95.1$

这仅适用于我的生产服务器 (nginx + gunicorn + postgres),在我的开发服务器上效果很好。

我该怎么办?

我也有

在 gunicorn 中增加超时有助于解决问题