今天发现nginx的log里面有报错,log如下

2019/06/10 19:01:46 [warn] 8294#0: *231715335 an upstream response is buffered to a temporary file /usr/local/nginx/proxy_temp/3/47/0003311473 while reading upstream, client: 144.123.15.66, server: oa.xxx.com.cn, request: "GET /sys/attachment/sys_att_main/sysAttMain.do?method=readDownload&fdId=16b406e3861578ee83d15344deb88105&open=1 HTTP/1.1", upstream: "http://10.254.2.16:80/sys/attachment/sys_att_main/sysAttMain.do?method=readDownload&fdId=16b406e3861578ee83d15344deb88105&open=1", host: "oa.xxx.com.cn", referrer: "http://oa.xxx.com.cn/km/review/km_review_main/kmReviewMain.do?method=view&fdId=16b4063ca15ddfca4ed8e3747d09968f"
2019/06/10 19:01:52 [warn] 8292#0: *231712177 an upstream response is buffered to a temporary file /usr/local/nginx/proxy_temp/4/47/0003311474 while reading upstream, client: 115.173.28.199, server: aqhcrm.xxx.com.cn, request: "GET /weixinfile/bonuspic/ebd192724baf49e782eb89a9f1b78e3f.png HTTP/1.1", upstream: "http://10.254.2.21:80/weixinfile/bonuspic/ebd192724baf49e782eb89a9f1b78e3f.png", host: "aqhcrm.xxx.com.cn", referrer: "http://aqhcrm.xxx.com.cn/modules/weixin/bonusSelf.html"

从error日志来看是nginx某一块的buffer设置的太小,(包含response header和response body)导致response结果不得不临时写到文件中,解决办法:
在nginx的http段,或location段增加如下参数,参数值根据实际应用需求调整,

proxy_buffering on;
client_max_body_size 500M;
client_body_buffer_size 500M;
proxy_buffer_size 5120k;
proxy_buffers 2560 5120k;
proxy_busy_buffers_size 5120k;
proxy_temp_file_write_size 5120k;

最后重启nginx报错日志消失;

带符号 * 的表示必填项