ScaleScaleScaleScale

Tips / Nginx


Nginx warning: A client request body is buffered to a temporary file /var/cache/nginx/client_temp/

nginx file upload

Today I had a strange issue on the Nginx server that I use for nginxtips.com, checking the logs I found this error:

A client request body is buffered to a temporary file:

2014/03/27 09:42:56 [warn] 5057#0: *556031 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000021, client: 12.34.56.78, server: nginxtips.com, request: “POST /wp-admin/async-upload.php HTTP/1.1”, host: “www.nginxtips.com”, referrer: “http://www.scalescale.com/tips/nginx/wp-admin/post.php?post=1730&action=edit”

While investigating this, I found in fact it was not an Nginx error, but just a warning (that’s why it is prefaced with [warn] at the beggining of the log) and that it happens when you upload a file. Basically, it means the size of the uploaded file is larger than memory buffer set for your file uploads.

If you need to tweak this, you can do it by editing client_body_buffer_size variable, that is the one that controls that buffer size. You can forget about this warning if your file uploads are small, if you have big file uploads then you may need to tweak it properly.

More information at Nginx Documentation.

Popular search terms:

  • a client request body is buffered to a temporary file
  • *980 a client request body is buffered to a temporary file /var/cache/nginx/client_temp
  • a client request body is buffered to a temporary file nginx
  • /var/cache/nginx/client_temp
profile

Esteban Borges

Linux Geek, Webperf Addict, Nginx Fan. CTO @Infranetworking

  • Nico

    Hi,

    Nevertheless, it is better to let the system write the content to the disk, because in case of concurrent uploads you will decrease the free RAM size because the buffer is on the RAM.

    Best regards,
    Nico