关于nginx error <a client request body is buffered to a temporary file>

报错日志

/v3.0/uploadIdentityPhoto.security HTTP/1.1", host: "xc-loan.nflow.internal"
2021/11/01 15:01:50 [warn] 1028#1028: *57622584 a client request body is buffered to a temporary file /tmp/client-body/0000003122, client: 240e:434:620:c52d:750e:9df0:6367:175b, server: xc-loan.nflow.internal, request: "POST /loan-web/api/common/user/v3.0/uploadIdentityPhoto.security HTTP/1.1", host: "xc-loan.nflow.internal"
2021/11/01 15:01:56 [warn] 1028#1028: *57622673 a client request body is buffered to a temporary file /tmp/client-body/0000003123, client: 2408:844f:7311:47b9:2cea:adff:fe0e:7242, server: xc-loan.nflow.internal, request: "POST /loan-web/api/common/user/v3.0/uploadIdentityPhoto.security HTTP/1.1", host: "xc-loan.nflow.internal"
2021/11/01 15:02:05 [warn] 1028#1028: *57622830 a client request body is buffered to a temporary file /tmp/client-body/0000003124, client: 125.112.37.67, server: xc-loan.nflow.internal, request: "POST /loan-web/api/common/user/v4.0/commonFaceVerify.security HTTP/1.1", host: "xc-loan.nflow.internal"

 解决方法

data:
  client-body-buffer-size: 256k
  proxy-body-size: 25m

另外,并不推荐将这两个值设置过大,因为这样的话会导致页面加载缓慢,浪费流量,用户体验不好,应该考虑将图片压缩处理

  1. client_body_buffer_size 设置客户端请求体的缓冲区大小。如果请求体大于缓冲区,整个请求体或一部分就会被写入一个临时文件。默认缓冲区大小等于两个内存页,在x86,x86-64等32位平台上是8K,64位平台上通常为16K
  2. client_body_max_size 设置客户端请求体的最大允许大小(在“Content-Length”请求头中指定的大小),如果请求中的大小超过配置的值(即client_max_body_size),就会返回413(请求实体太大)错误码给客户端。需要注意的是,浏览器无法正确显示此错误。将大小设置为0将禁用检查客户端请求体大小
原文地址:https://www.cnblogs.com/apink/p/15500271.html