413 Request Entity Too Large

HTTP 413 status code means a server refuses to process the request because the request body (also known as request entity or payload) is too large.

The server may choose to close the connection to prevent the client from finishing the request. However, if the condition is temporary (e.g., data upload quota for an API service), the server should send the Retry-After HTTP header prompting the client to retry after a certain period.

Apache

You can impose the limit on request body size by setting the LimitRequestBody config in Apache. It defaults to 0, which means there are no restrictions on request body size.

LimitRequestBody 1024000

It is worth mentioning that the limit is typically imposed by PHP. To increase the file upload and POST request size to 10 megabytes, set the following lines in php.ini file.

upload_max_filesize = 10M
post_max_size = 10M

Nginx

In Nginx, the request body size limit is governed by the client_max_body_size config, which is set to 1M (1 megabyte) by default. To increase the limit to 10 megabytes, for example, set the following line in /etc/nginx/nginx.conf file.

client_max_body_size 10M;

You can disable the file size checking altogether by setting client_max_body_size to 0, although you open up yourself for a DoS attack.