问题描述
我有适用于Python Django应用程式的Nginx + uWSGI。
I have Nginx + uWSGI for Python Django app.
我在 nginx.conf
中有以下内容:
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:9001;
uwsgi_read_timeout 1800;
uwsgi_send_timeout 300;
client_header_timeout 300;
proxy_read_timeout 300;
index index.html index.htm;
}
但对于uWSGI上长时间运行的请求,大约需要1分钟才能完成Nginx错误日志中的超时错误如下:
but for long running requests on uWSGI which takes about 1 minute to complete I get a timeout error in Nginx error log as below:
我已经设置标题时间
推荐答案
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:9001;
uwsgi_read_timeout 300;
index index.html index.htm;
}
问题中的上述配置对我们不起作用的原因,我们的机器多个路径有 nginx.conf
文件。我们正在与错误的路径工作。
The reason the above configuration in the question did not work for us because unfortunately in our machine multiple paths had nginx.conf
file. We were working with the conf at the wrong path.
要正确确定nginx从运行中获取配置的路径:
To correctly figure out which path your nginx is picking up the configuration from run:
nginx -V # V is caps
这将有一个 - conf-path = []
它会告诉你从哪里获取配置。
this will have a --conf-path=[]
which will tell you exactly from where it is picking up the configuration from.
我最近发现上面 nginx -V
不给正确的信息。我会离开上述,以防其他人觉得有用。
I recently found the above nginx -V
to not give the right info. I will leave the above just in case others find it useful.
这篇关于Nginx超时,当uWSGI需要很长时间来处理请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!