![读取上游响应头时上游超时(110:连接超时)](https://linux22.com/image/629714/%E8%AF%BB%E5%8F%96%E4%B8%8A%E6%B8%B8%E5%93%8D%E5%BA%94%E5%A4%B4%E6%97%B6%E4%B8%8A%E6%B8%B8%E8%B6%85%E6%97%B6%EF%BC%88110%EF%BC%9A%E8%BF%9E%E6%8E%A5%E8%B6%85%E6%97%B6%EF%BC%89.png)
由于某种原因,每当我在服务器上运行查询时,我都会收到此错误。在我的本地设置中,此查询大约需要 7-8 秒才能返回,但它在我的实际服务器上一直超时。
错误:
2014/03/26 13:40:13 [error] 11084#0: *22 upstream timed out (110: Connection timed out) while reading response header from upstream, client: xxxxx, server: xxxx request: "GET /xxxxx/ HTTP/1.1", upstream: "uwsgi://unix:///srv/www/poka/app/poka/nginx/poka.sock", host: "xxxx"
2014/03/26 13:41:26 [error] 11084#0: *80 upstream timed out (110: Connection timed out) while reading response header from upstream, client: xxxxx, server: xxx, request: "GET /xxxxx/?format=json HTTP/1.1", upstream: "uwsgi://unix:///srv/www/poka/app/poka/nginx/poka.sock", host: "xxxx.$
我正在运行 Django/Nginx/uWSGI。
这是我的 nginx 配置:
# poka _nginx.conf
# the upstream component nginx needs to connect to
upstream django {
server unix:///srv/www/poka/app/poka/nginx/poka.sock; # for a file socket
}
# configuration of the server
server {
# the port your site will be served on
listen 443;
ssl on;
ssl_certificate /etc/xxx/xxx.pem;
ssl_certificate_key /etc/xxx/xxx.key;
# the domain name it will serve for
server_name xxxx; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 750M; # adjust to taste
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /srv/www/poka/app/poka/nginx/uwsgi_params; # the uwsgi_params file you installed
}
}
这是我的 uWSGI 配置:
master = true
processes = 2
socket = /srv/www/poka/app/poka/nginx/poka.sock
chmod-socket = 666
vacuum = true
pidfile = /tmp/project-master.pid # create a pidfile
harakiri = 120 # respawn processes taking more than 20 seconds
max-requests = 5000 # respawn processes after serving 5000 requests
log-maxsize = 10000000
post-buffering=4096
logto = /var/log/uwsgi/poka.log # background the process & log