In a normal nginx installation, this error is solved by making an amendment to the nginx.conf file and the php.ini file.

The nginx.conf file is found at /etc/nginx/nginx.conf while php.ini is to be found at /etc/php.ini

In nginx.conf, the directive has to be added: 

client_max_body_size = 100M;

In the php.ini, the upload_max_filesize directive has to be at the same value.

Thereafter, nginx has to be started with the command “service nginx reload”.

However, this appears to have no effect and the error

413 “Request Entity Too Large”

continues to occur.

If you to the VirtualMin and apply the configuration change, it throws up the error:

“client_max_body_size” directive is not allowed here in /etc/nginx/nginx.conf

The solution is that the “client_max_body_size” directive has to be applied in the server block as well as the location block.

server {

    …

    client_max_body_size 200M;

}

location / {

    …

    client_max_body_size 200M;

}

Now, if you save the file and apply the changes, everything works fine.

Thanks to http://stackoverflow.com/questions/2056124/nginx-client-max-body-size-has-no-effect

VirtualMin: 413 “Request Entity Too Large” error with uploading a file

Leave a Reply

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