我正在尝试通过 uWSGI 在 Nginx 上提供 Flask 应用程序(第一次使用 Nginx for Flask)。
Nginx 配置如下:
server {
listen 80;
location / {
include uwsgi_params;
uwsgi_pass flask:5555;
}
client_max_body_size 100M;
client_header_timeout 120s;
client_body_timeout 120s;
keepalive_timeout 120s;
send_timeout 120s;
}
和uWSGI
wsgi-file = run.py
callable = app
socket = :5555
processes = 4
threads = 2
master = true
chmod-socket = 660
vacuum = true
die-on-term = true
但是负载较大的 Flask 应用无论如何都会在 1 分钟后在 Nginx 端超时。
Flask 应用程序从终端运行时工作正常。
有什么建议吗?
解决了在 uWSGI 中添加超时的问题nginx.conf
as
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;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)