Nginx proxy server 10k files cannot be uploaded

When we used Nginx as the proxy server, when uploading files, the upload of files larger than 10k failed, because the background service did not receive the request at this time, so troubleshooting in the Nginx configuration finally found the problem.

1. Modify Nginx's .conf configuration file

client_body_buffer_size 8m;  # 分配给请求数据的buffer大小
client_body_temp /var/lib/nginx/body;  # 指定的临时路径
client_max_body_size 100m;  # 默认1M,表示客户端请求服务器最大允许大小

2. Modify the temporary path permissions

cd /var/lib/nginx  #.conf中配置的client_body_temp路径
chmod 777 body

3. Remarks

  • If the data is larger than client_max_body_size, it must fail.
  • Less than client_body_buffer_size is directly stored in memory efficiently.
  • If it is larger than client_body_buffer_size and smaller than client_max_body_size, temporary files will be stored, so the temporary file path must be configured with permissions.
  • If you are pursuing efficiency, set client_max_body_size and client_body_buffer_size to the same value and large, so you can upload directly.

Guess you like

Origin blog.csdn.net/DearestFriend/article/details/108584822