What does 413 Request Entity Too Large mean?
This is a server side error which happens when you send a big request to your server which is more than it could possibly handle so it throws this error 413 Request Entity Too Large.
What are the reasons for 413 Request Entity Too Large Error?
There are many cases that are the reason for this error, we will mention some of them below:-
- Trying to upload large file from WordPress/non-WordPress admin panel or even from frontend.
- Trying to update WordPress theme, plugin or even WordPress core which has big size.
- If you are using caching plugins like WP Rocket and you have page(s) with huge HTML.
How can we solve 413 Request Entity Too Large Error?
On this section we will talk about how to solve this error by changing the configurations to handle larger content, However please be careful not to increase this option too much so it may affect your site performance/security dramatically.
For Nginx users:
- Open nginx configuration file which is located here: /etc/nginx/nginx.conf
- Search for the directive client_max_body_size there.
- If you found it there you can update it to be like (100MB for example):
client_max_body_size 100M; - If not found there please add it like:-
server {
client_max_body_size 100M;
…
} - Save changes and restart or reload Nginx service by running the following command:
service nginx reload
You may want sudo permission.
Please note that the default value for this option on Nginx is: 1M (1 megabyte) and if you don’t want to have a limit you can set it to zero (be careful)
For Apache users:
- Open your .htaccess file.
- Add the following directive (100MB for example):
LimitRequestBody 104857600 - Save changes and restart apache service by running the following command:
service apache2 reload
You may want sudo permission.
Please note that the default value for this option on Nginx is: 0 and Feel free changing its value in bytes.
Additional context:
You may also change the following two options at your php.ini configuration file:-
- upload_max_filesize which defines the maximum allowed size for uploaded files (default is 2 MB).
- post_max_size which defines the maximum size of POST data that PHP will accept. This setting also affects the file uploads (default is 8 MB).
References:
http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size
http://httpd.apache.org/docs/2.0/mod/core.html#limitrequestbody
http://php.net/upload-max-filesize
http://php.net/post-max-size