nginx日志error.log中出现下面信息:
2019/04/18 16:33:24 [error] 27936#0: *446200 upstream timed out (110: Connection timed out) while reading response header from upstream, client: ...
修改nginx配置
# vi conf.d/default.conf
在server{}块中添加下面内容:
large_client_header_buffers 4 16k;
client_max_body_size 300m;
client_body_buffer_size 128k;
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
proxy_buffer_size 64k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
参数说明:
large_client_header_buffers:
设置用于读取大型客户端请求头的缓冲区的最大数量和大小,这些缓冲区仅在缺省缓冲区不足时按需分配。
client_max_body_size:
设置NGINX能处理的最大请求主体大小,默认值 1M。如果请求大于指定的大小,则NGINX发回 HTTP 413(Request Entity too large)错误。
client_body_buffer_size:
设置用于请求主体的缓冲区大小,默认值 16k。如果主体超过缓冲区大小,则完整主体或其一部分将写入临时文件。
proxy_connect_timeout:
设置与 upstream server 的连接超时时间,默认值 60s。
proxy_read_timeout:
设置与代理服务器的读超时时间,默认值 60s。它决定了nginx会等待最长多长时间来获得请求的响应。
proxy_send_timeout:
设置了发送请求给upstream服务器的超时时间,默认值 60s。
proxy_buffer_size:
设置后端 response 的 buffer 的大小。
proxy_buffers:
设置request 的 buffer 的数量和大小。
proxy_busy_buffers_size:
设置忙时 buffer 的最大值。
proxy_temp_file_write_size:
设置缓存文件夹大小。
重载配置文件
# nginx -s reload
参考:
https://blog.51cto.com/inbank2012/1097945
https://blog.csdn.net/qq_29663071/article/details/80759098
转载于:https://blog.51cto.com/xiaoxiaozhou/2381968