Troubleshoot 413 - Request Entity Too Large
Problem
Certain actions such as uploading large files result in a Request Entity Too Large
error message or
response.
Cause
A 413 Request Entity Too Large
error occurs when a request made from a client is too large to be
processed by the web server. If your web server is setting a particular HTTP request size limit, clients may come
across a 413 Request Entity Too Large
response. An example request, that may cause this error would be if a
client was trying to upload a large file to the server (e.g. a large media file).
Resolution
Depending on which web server you use, implement the necessary changes described below to configure your web server's maximum HTTP request size allowance.
If you're still having trouble after following this guide, for more assistance please read: Troubleshooting file upload issues
nginx
The directive which determines what the allowable HTTP request size can be is client_max_body_size
.
This directive may already be defined in your nginx.conf
file located at /etc/nginx/nginx.conf
.
However, if it isn't, you can add that directive in either an http
, server
, or
location
block and define a value.
server {
client_max_body_size 100M;
...
}
The default value for this directive is 1M (1 megabyte)
. If you do not wish to have a request
size limit you can set the value to 0
.
Once you have set your desired value, save your changes and reload Nginx by running the following command:
service nginx reload
Apache
The directive which determines what allowable HTTP request size can be is LimitRequestBody
.
The directive can be defined in your http.conf
file.
LimitRequestBody 104857600
The default value for this directive in Apache is 0
, however, you may set this value to whatever
you like (the value is represented in bytes
).
Once you are done making your changes, save the configuration file and reload Apache using the following command:
service apache2 reload