由于某些原因,当我的Flas应用程序部署到Docker时,它将在多个请求上崩溃并出现错误
nginx | 2020/06/26 20:41:39 [error] 20#20: *1 upstream prematurely closed connection while reading response header from upstream, client: 172.18.0.1, server: , request: "POST /api/v1.0/export HTTP/1.1", upstream: "uwsgi://172.18.0.2:5555", host: "127.0.0.1:80"
flask | DAMN ! worker 4 (pid: 16) died, killed by signal 9 :( trying respawn ...
flask | Respawned uWSGI worker 4 (new pid: 18)
在venv
上运行时,该应用可以正常运行
uWSGI配置如下:
[uwsgi]
wsgi-file = run.py
callable = app
socket = :5555
processes = 16
threads = 2
master = true
chmod-socket = 660
vacuum = true
die-on-term = true
harakiri-verbose = true
和nginx的配置如下:
server {
listen 80;
location / {
include uwsgi_params;
uwsgi_pass flask:5555;
uwsgi_read_timeout 300;
}
client_max_body_size 100M;
client_header_timeout 120s;
client_body_timeout 120s;
keepalive_timeout 120s;
send_timeout 120s;
}
对此有何想法?