Error: 413 - Request Entity Too Large in Nginx

Matt LaFalce avatar
Matt LaFalce
Cover for Error: 413 - Request Entity Too Large in Nginx

Why am I seeing Error: 413 “Request Entity Too Large” in Nginx?

This is happening because your nginx server does not allow you to upload a file that is larger than the defined size in nginx config file. To solve it, you have to modify your nginx configuration.

Follow the step to add/modify your nginx config file.

Step 1: Connect to your nginx server with your terminal.

ssh user@my_server

Step 2: Go to the config location and open it

sudo vim /etc/nginx/nginx.conf

Step 3: Adding/Modifying the client_max_body_size variable

If you find it, just increase its size to 100M, If it doesn’t exist, then you can add the below code inside and at the end of HTTP settings:

client_max_body_size 100M;

Step 4: Restart nginx to apply the changes

sudo service nginx restart