Nginx: 413 – Request Entity Too Large Error and Solution

I am trying to upload 30MB file on my Ubuntu 20 server and its not working.

When I upload a 3MB file, I receive “413 Request Entity Too Large” with nginx/1.18.0

When I upload 30MB file, the page loads “Page Not Found

I am trying to find nginx and

I can increase “client_max_body_size”

let, us trying to find nginx

cd /etc/nginx/nginx.conf

Open nginx.conf file

vi nginx.conf

or

Type commands

vi /etc/nginx/nginx.conf

Add a line in the http section:

client_max_body_size 100M;

Note ->Please enter domain nginx file :

sudo /etc/nginx/sites-available
or

ls and open domain directory

vi defult

Add to file this code

}
location /uplods {
client_max_body_size 100M;
}

If you get error use this command

Than I have made all necessary changes in my php.ini files,

Then for php location

for nowdays maximum use php 7.4 or higher

sudo vi /etc/php/7.4/fpm/php.ini  which php you use

check those increasing by your desire .

memory_limit = 128M 
post_max_size = 20M  
upload_max_filesize = 10M
service php-fpm restart 
And then I change the paramitear in php.ini, 


max_input_time = 24000
   max_execution_time = 24000
   upload_max_filesize = 12000M
   post_max_size = 24000M
   memory_limit = 12000M

And what you can not forget is to restart nginx and php-fpm,

Leave a Reply

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