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.
Thank you! Worked like a charm. Make sure you add the “;” at the end of the line though.
Thanks for pointing out Fayena. I have made the change.
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.
You great MAN!!! Thanks!
Most welcome Dima 🙂
Thank you, you’ve helped me!
Thank-you! This post just saved me loads of time.
Thanks a lot.
Awesome, this was a big help. On to the next problem 😉
Thx for this hint. I increased this param to 20MB and now everything is ok 🙂
great, it worked like a charm, thanks.
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.
Thank you!!! You saved my life!!!
Thanx !
Thanks a lot!!!
Thanks a lot, you saved my day!!
I have been tracking this down for DAYS.
Thanks so much for your solution!
Fantastic.. just the fix I needed
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 🙂
This post is my savior~
Thank you so much
Thanks for the solution, Jesin!
Thank you, usefull.
Thank you! This fixed it for me as well.