I recently encountered this error on this WordPress installation running on nginx webserver. I tried to upload a file of size 1.14MB for the article download vmnetcfg.exe when WordPress displayed “HTTP error” in red. I thought it was a problem with either PHP’s max_execution_time or max_upload_filesize directives, but modifying them did not solve the problem. Taking a look at the PHP error log I couldn’t find anything helpful. Finally I saw nginx’s error log which contained this error.
The nginx error log located at /var/log/nginx/error.log contained the following line
From this error we can understand that an attempt to upload a file using POST method was made which ended up with the error “client intended to send too large body” to fix this a nginx directive named client_max_body_size has to be created/modified. Open the nginx configuration file
vi /etc/nginx/nginx.conf
add or modify the following line inside http {…}
client_max_body_size 20M;
then reload nginx
service nginx reload
This will allow file uploads with sizes upto 20MB, the default value of this directive is 1M which is the reason why this error occurs. Alternatively this directive can be used inside the server {…} or location{…} contexts if you want this setting to apply only to a particular vhost or location.
Fayena says
Thank you! Worked like a charm. Make sure you add the “;” at the end of the line though.
A.Jesin says
Thanks for pointing out Fayena. I have made the change.
Bad Robot says
Later versions of Nginx don’t like the directive in the /etc/nginx/nginx.conf location.
However in the server section it does work! Thanks.
Dima says
You great MAN!!! Thanks!
A.Jesin says
Most welcome Dima 🙂
Slava says
Thank you, you’ve helped me!
Scott Mackenzie says
Thank-you! This post just saved me loads of time.
Azeem says
Thanks a lot.
James says
Awesome, this was a big help. On to the next problem 😉
Niszczarek says
Thx for this hint. I increased this param to 20MB and now everything is ok 🙂
jag says
great, it worked like a charm, thanks.
Andrew Ray says
Thanks! Your post comes up top on google about this error, and is still relevant today! I wish nginx log files would mention what config directive needs to be changed with an error.
Telmo Stefani says
Thank you!!! You saved my life!!!
Dimitris says
Thanx !
Denis says
Thanks a lot!!!
Will says
Thanks a lot, you saved my day!!
Brandon says
I have been tracking this down for DAYS.
Thanks so much for your solution!
Antony says
Fantastic.. just the fix I needed
Gwyneth Llewelyn says
Just to give you a thumbs up ? since your solution in 2017 still fixes errors! One wonders why, after four years, the nginx defaults are still so low…
Thanks so much for posting your solution 🙂
raiz says
This post is my savior~
Thank you so much
Alex says
Thanks for the solution, Jesin!
MinionsPlush says
Thank you, usefull.
Brandon Froehlich says
Thank you! This fixed it for me as well.