nginx每隔几个小时就会报下面的错误:
2014/03/05 03:36:34 [error] 12732#0: *6260392 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 116.211.118.11, server: localhost, request: "GET / HTTP/1.1", upstream: "http://172.16.1.4:80/", host:
报这个错误之后,整个服务器就不响应了,但是nginx后面的webpy程序没有任何错误,后端的数据库也很正常,从网上查了很多资料,都是说要修改proxy_read_timeout,proxy_send_timeout和proxy_buffer几个相关设置的值。
如下配置,要放在server配置节之内
large_client_header_buffers 4 16k;
client_max_body_size 30m;
client_body_buffer_size 128k;
#proxy_connect_timeout 300;
#proxy_read_timeout 300;
#proxy_send_timeout 300;
#proxy_buffer_size 64k;
#proxy_buffers 4 32k;
#proxy_busy_buffers_size 64k;
#proxy_temp_file_write_size 64k;
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;
你可以看到上面是proxy_和fastcgi_两种配置,就是说如果你的nginx后面是proxy,就设置proxy相关的配置,如果是fastcgi就设置fastcgi相关的配置。
###最后推荐一个汇集IT技术资料站的导航站