nginx proxy超时报错 upstream timed out (110: Connec...

时间:2024-04-08 22:05:14

环境介绍 
服务器:centos6.4
服务:nginx proxy

问题描述:

然后查找  /opt/usr/nginx/1.4.0/logs  错误 error.log日志提示如下

2015/01/04 15:44:13 [error] 10112#0: *994662 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 117.32.232.172, server: localhost, request: "POST /community-platform/datastatistics/datastatistics_exportAllUserDataDetail.action HTTP/1.1", upstream: "http://10.172.11.194:9080/community-platform/datastatistics/datastatistics_exportAllUserDataDetail.action", host: "admin.zhsqcn.com", referrer: "http://admin.zhsqcn.com/community-platform/datastatistics/datastatistics_communityStatistics.action?leftPid=98"
2015/01/04 15:45:22 [info] 10112#0: *994692 client closed connection while waiting for request, client: 117.32.232.172, server: 0.0.0.0:80

2015/01/04 15:57:10 [info] 10112#0: *994707 client 1.85.57.66 closed keepalive connection
2015/01/04 15:57:19 [info] 10112#0: *994711 client 1.85.57.66 closed keepalive connection
2015/01/04 15:57:19 [info] 10112#0: *994718 client closed connection while waiting for request, client: 1.85.57.66, server: 0.0.0.0:80

解决方法:vi  /opt/usr/nginx/1.4.0/conf/nginx.conf
原因在于nginx proxy的超时时间太短
proxy_connect_timeout    3;
proxy_read_timeout       30;
proxy_send_timeout       30;

更改为

proxy_connect_timeout    600;
proxy_read_timeout       600;
proxy_send_timeout       600;

然后重启nginx即可:

/opt/usr/nginx/1.4.0/sbin/nginx -s reload