WHM Nginx Manager Enabled Gives 413 Request Entity Too Large Error and Solution

Website Developer Sydney

With Nginx Manager Enabled in WHM Cpanel you receive a 413 Error when uploading to WordPress (or other sites)

Recently WHM / Cpanel enabled an option for Nginx Manager

Screen Shot 2021 07 08 at 13 04 56

With this option enabled in Cpanel you may receive a 413 Error when uploading large files like plugins to your WordPress Site.

40a790a861524d2388303a8b0f6a454e 413 request entity too large error jpg

 

Not it’s worth mentioning that there are potentially a couple of places that the size upload limit is set. This error relates specifically to the Nginx Manager options for caching in WHM and Cpanel that was added as an option in 2021. 

There are also options in the MultiPHP INI Editor to se the upload_max_filesize that we are presuming you have already set in your WHM configuration panel.

Screen Shot 2021 07 08 at 13 45 38

So assuming that you have previously set these limits and have had no trouble uploading things like large plugins for WordPress or images etc, then you will likely find that the error for 413 is related to the enabling of Nginx in the recent whm update.

The solution for 413 Request Entity Too Large

To fix the issue you will need to edit the Nginx.conf file on your web server. This file among other things controls the configuration settings for allowing larger uploads. It has defaulted to a small size to avoid denial of service attacks where people try to throw large files at your site and block it from general access.

Editing conf files can be done using various linux editors. We suggest Nano as it is easy for those who like me are simple. If nano is not installed you can follow these instructions here: https://phoenixnap.com/kb/use-nano-text-editor-commands-linux

Login to your WHM Management and search for Terminal and select it.  (Note that if you have the skills you can also connect to your server using your favourite Terminal software as a root user, we are using the web interface here as it is easier). 

Use nano text editor:
$ sudo nano /etc/nginx/nginx.conf

Add the following line to the end of the http or server or location context to increase the size of the Nginx.conf size limit

# set client body size to 20M #
client_max_body_size 20M;
(Note that the 20 M is for 20 meg. You can set it to any size you like and should probably match the size set in the MultiPHP INI for the PHP versions that you set in WHM.)

Screen Shot 2021 07 08 at 14 02 43

 

Screen Shot 2021 07 08 at 14 03 10

Once you have edited the file you can Exit using the Control X keys.

Screen Shot 2021 07 08 at 14 14 47

 

Then search for in WHM your Nginx Manager.

Click on the Restart Nginx button.

Screen Shot 2021 07 08 at 14 16 16

That is it and should get you running.

Leave a Reply

Your email address will not be published. Required fields are marked *