Nginx Error – 413 Request Entity Too Large

KB ID 0001325 Dtd 05/07/17

Problem

A few weeks ago I did a series on setting up a new WordPress site, shortly after I had some problems uploading my caching plugin (wp-rocket). This was the error I got;

413 Request Entity Too Large

413 Request Entity Too Large
nginx/1.10.3 (Ubuntu)

Anyway, I fixed the error, and a few days later I got an email from someone with the same problem, so I thought this time I would document the fix.

 

Solution

Note: I’m going to raise the limits to 100Mb this might be far to large for you, 20 or 50Mb might be more sensible for most sites.

Firstly you need to make an entry in the nginx.conf file

sudo nano /etc/nginx/nginx.conf

If you’re unused to working in these config files, you are looking for the http section, just before this sections ends (i.e. before the end curly bracket ‘}’), insert the following text.

client_max_body_size 100M;

Exit and Save the file (ctrl+x, then ‘y’ {Enter}.

Worpress Raise Upload Limit

Restart nginx.

sudo service nginx restart

You will also need to enter the new values in the php.ini file.

sudo nano /etc/php/7.0/fpm/php.ini

Change the following values, like so;

upload_max_filesize = 100M
post_max_size = 100M

PHPRaise Upload File Size Limit

Wordpress Raise Post Size Limit

Exit and save the file, then restart PHP.

sudo service php7.0-fpm restart

 

Related Articles, References, Credits, or External Links

WordPress – HTTP Error

Author: PeteLong

Share This Post On

Submit a Comment

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