16 Mar

NGINX 413 (Request Entity Too Large) error

If you have files that need to be downloaded from your site that are larger than 64M, our default setting, then you will need to adjust client_max_body_size in order to allow for larger file downloads.
To know if your hitting this error you can search the NGINX error logs for 413 errors similar to the following.

Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)

To increase this limit you will need to find which config file it’s located in. Running the following will help you find which one.

grep -rn client_max_body_size /*/nginx*

Once you have found which file, you will want to open it up and raise it to a value that will allow your file to be downloaded in the future. An explanation of the value can be found in the NGINX documentation. http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size

client_max_body_size 64M;

After you have edited that line you will want to restart your NGINX. But first do a quick syntax check of the configuration with the following command.

nginx -t

Now you can restart NGINX.

service nginx restart

photo credit: semi finals via photopin (license)

Share this