解决Nginx响应超时问题:upstream timed out (110: Connection timed out)

558次阅读
没有评论

一、问题现象
通常当我们在进行web页面访问的时候,会出现报错504。页面无法显示出来
查看日志,发现如下:
upstream timed out (110: Connection timed out) while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: *, request: “POST /store/dsmgmt/signin HTTP/1.0”, upstream: “http://unix:/dev/shm/run/gunicorn.sock:/store/dsmgmt/signin”, host: “xxx.xxx.xxx.xxx”, referrer: “http://xxx.xxx.xxx.xxx/”

问题简述:
upstream timed out :反向代理连接超时

二、解决方法
1、修改反向代理超时时间,如下所示:

[root@a abc]# cat nginx.conf
server {
listen 80;
server_name nginx.ee.com;
access_log /a/logs/nginx/nginx.gree.com_access.log main;
error_log /a/logs/nginx/zabbix.gree.com_error.log error ;
root /a/webserver/nginx;
index index.html index.htm index.php;

   #error Connection timed out and 504 error
   large_client_header_buffers 4 16k;
   client_max_body_size 30m;
   client_body_buffer_size 128k;
   fastcgi_connect_timeout 300;
   fastcgi_read_timeout 300;
   fastcgi_send_timeout 300;
   fastcgi_buffer_size 64k;
   fastcgi_buffers   4 32k;
   fastcgi_busy_buffers_size 64k;
   fastcgi_temp_file_write_size 64k;

}
如下所示,添加反向代理超时时间
注意 在server标签内进行如下天
在server标签内添加如下内容:

error Connection timed out and 504 error

large_client_header_buffers 4 16k;
client_max_body_size 30m;
client_body_buffer_size 128k;
fastcgi_connect_timeout 300;
fastcgi_read_timeout 300;
fastcgi_send_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 32k;
fastcgi_busy_buffers_size 64k;
fastcgi_temp_file_write_size 64k;
2、再重启nginx服务

正文完
可以使用微信扫码关注公众号(ID:xzluomor)
post-qrcode
 
评论(没有评论)