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.

Add the following line within the http block

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 in the comments if this helped. Follow me @DevAnswers or read more.

1 Star2 Stars3 Stars4 Stars5 Stars 5.00 (2 votes)


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

We use Markdown to style comments, like on Github and Reddit.
To do a line break, type two spaces after the sentence.
You can add inline code by wrapping it in backticks: `code here`

    To do an entire block of code  
    type four spaces before the line
    and it will appear in a block like this.
    <-- four empty spaces