[Solved] 413 Request Entity Too Large error on NGINX web server
A 413 Request Entity Too Large Error is an HTTP status code that occurs when a web server receives a request that is too large for it to process. This error typically occurs when the size of the data being sent by the client exceeds the maximum size allowed by the server. It can also occur if the server is unable to handle a large amount of data due to limited resources. In either case, this error prevents users from accessing content on the website and should be addressed as soon as possible. In this tutorial we discuss how to fix this error on an NGINX web server.
What Is the “Error 413 Request Entity Too Large” Error?
Fixing the error by editing the NGINX config file for the affected website.
Let’s assume that you are trying to upload a file that is 500MB in size. When you try to upload the file you get the error message:
‘Error 413 Request Entity Too Large’
You then decide to inspect the virtual host log file for the website and you see the log entry shown below:
Edit the virtual host configuration file for the affected site. Usually, it is located in the /etc/nginx/sites-available/ directory. Under the server section, add the line:
This will set a limit of 1024M on the client_max_body_size parameter. Restart NGINX for the changes to take effect
Edit your WordPress functions .php file
If the error is happening on a WordPress site you can try to fix the error by editing the functions.php file. The functions.php file is an integral part of any WordPress website. It is the file that stores all the custom code and functions used to modify the behavior of your WordPress website. This file allows you to add new features, modify existing ones, and customize your website in various ways without having to write complex code.
To edit the file, navigate to the root folder that contains all WordPress files and locate the function.php file. Run the command: