Nginx error: 413 Request Entity Too Large

Last updated on

If you are trying to upload large files and are seeing this error, it means the client_max_body_size value is too low.

Open the nginx configuration file:

sudo nano /etc/nginx/nginx.conf

It may also be located in /usr/local/nginx/conf/nginx.conf or /usr/local/etc/nginx/nginx.conf.

If you can’t find your Nginx config, see: Where is the Nginx Config File Located?

Add the following line within the http block

/etc/nginx/nginx.conf
http {
    . . .
    client_max_body_size 32M;
    . . .
} 

Save and exit (press CTRL + X, press Y and then press ENTER)

Now, check if the Nginx config file syntax is valid.

sudo nginx -t

If valid, restart Nginx service.

service nginx restart

You may also need to edit the php.ini configuration file.

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

Leave a reply

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