环境介绍
服务器:centos6.5
服务:nginx proxy
问题描述:
压测 开发同事 的开发环境项目没事,但是 线上机器 命中%50 ,大量502
php的某些页面打不开,页面提示gateway timeout,然后查找日志提示如下
2015/09/19 14:00:30 [error] 1811#0: *319 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 58.38.218.159, server: www.iserver.com, request: "GET /invrenjie/image_new/myfiona/120913/MY-1263/mins021_950.jpg HTTP/1.1", upstream: "http://server:80/invrenjie/image_new/myfiona/120913/MY-1263/mins021_950.jpg", host: "www.server.com"
解决方法:
原因在于nginx proxy的超时时间太短
proxy_connect_timeout 60;
proxy_read_timeout 600;
proxy_send_timeout 600;
更改为
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
然后重启nginx即可