Jesin's Blog

Welcome to the Portal of Technology

  • Facebook
  • GitHub
  • RSS
  • Twitter
  • Home
  • Categories
    • Domains
    • Linux
    • Networking
    • PHP
    • Virtualization
    • Web Design
    • Web Servers
    • Windows
  • WordPress Plugins
    • Custom Error Pages
    • HTTP Digest Authentication
    • Mailgun Email Validator
  • Toolbox
    • DNS Lookup Tool
    • htdigest Generator Tool Online
    • htpasswd Generator Tool Online
    • HTTP Headers Lookup Tool
    • MD5 Encryption Tool
    • Open Port Check Tool
    • SHA-1 Encryption Tool
    • URL Encoding/Decoding Tool
  • About Me
  • Contact Me
  • Sitemap
Home ›
Web Servers ›
Fix the client intended to send too large body nginx error

Fix the client intended to send too large body nginx error

February 25, 2013 Web Servers Jesin A 24 Comments

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

[error] 31354#0: *10899 client intended to send too large body: 1198151 bytes, client: <IP address>, server: example.com, request: “POST /wp-admin/async-upload.php HTTP/1.1”, host: “example.com”, referrer: “http://example.com/wp-admin/post.php?post=<post id>&action=edit”

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.

Related posts:

nginx php5 fpm socket permission denied thumbnailHow to fix connect() to php5-fpm.sock failed (13: Permission denied) while connecting to upstream Nginx error linux category thumbnailHow to configure a Linux PPTP VPN client wordpress custom 403 error pageCustom 403 and 401 error pages in WordPress Default ThumbnailHow to create custom error page in Apache Default ThumbnailUsing the Apache Redirect directive

Tags: nginx, nginx errors

Comments

  1. Fayena says

    March 19, 2013 at 12:17 am

    Thank you! Worked like a charm. Make sure you add the “;” at the end of the line though.

    Reply
    • A.Jesin says

      March 19, 2013 at 3:50 pm

      Thanks for pointing out Fayena. I have made the change.

      Reply
      • Bad Robot says

        October 17, 2017 at 6:47 am

        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.

        Reply
  2. Dima says

    June 24, 2013 at 8:20 am

    You great MAN!!! Thanks!

    Reply
    • A.Jesin says

      June 24, 2013 at 3:03 pm

      Most welcome Dima 🙂

      Reply
  3. Slava says

    November 27, 2013 at 11:35 am

    Thank you, you’ve helped me!

    Reply
  4. Scott Mackenzie says

    January 1, 2014 at 6:29 pm

    Thank-you! This post just saved me loads of time.

    Reply
  5. Azeem says

    April 16, 2014 at 10:35 am

    Thanks a lot.

    Reply
  6. James says

    February 11, 2015 at 6:10 am

    Awesome, this was a big help. On to the next problem 😉

    Reply
  7. Niszczarek says

    April 23, 2015 at 11:19 pm

    Thx for this hint. I increased this param to 20MB and now everything is ok 🙂

    Reply
  8. jag says

    August 4, 2015 at 2:03 am

    great, it worked like a charm, thanks.

    Reply
  9. Andrew Ray says

    April 4, 2016 at 12:19 pm

    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.

    Reply
  10. Telmo Stefani says

    April 15, 2016 at 6:40 pm

    Thank you!!! You saved my life!!!

    Reply
  11. Dimitris says

    June 29, 2016 at 5:40 pm

    Thanx !

    Reply
  12. Denis says

    November 10, 2016 at 8:32 pm

    Thanks a lot!!!

    Reply
  13. Will says

    December 11, 2016 at 1:44 pm

    Thanks a lot, you saved my day!!

    Reply
  14. Brandon says

    January 13, 2017 at 7:04 pm

    I have been tracking this down for DAYS.
    Thanks so much for your solution!

    Reply
  15. Antony says

    March 8, 2017 at 12:17 am

    Fantastic.. just the fix I needed

    Reply
  16. Gwyneth Llewelyn says

    July 11, 2017 at 5:23 am

    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 🙂

    Reply
  17. raiz says

    July 27, 2017 at 9:27 pm

    This post is my savior~
    Thank you so much

    Reply
  18. Alex says

    September 30, 2017 at 5:51 pm

    Thanks for the solution, Jesin!

    Reply
  19. MinionsPlush says

    November 5, 2017 at 12:34 pm

    Thank you, usefull.

    Reply
  20. Brandon Froehlich says

    March 24, 2018 at 2:34 am

    Thank you! This fixed it for me as well.

    Reply

Trackbacks

  1. Increase Maximum File Upload for a WordPress Site | Matt Swarts's Blog says:
    September 28, 2015 at 8:48 am

    […] get a ‘send body too large error in nginx error.log’. It can be fixed as well using this […]

    Reply

Leave a Reply Cancel reply

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

Get a wealth of information delivered to your inbox. Subscribe and never miss a single article.

  • Tutorials and howtos
  • Code, scripts and commands
  • Online Tools

* No spam, unsubscribe anytime

Hire Me

  • SSL installation and hardening (A+ on Qualys SSL test)
  • Apache & Nginx configuration
  • Email deliverability improvement (10/10 on Mail Tester & MailGenius)
  • WordPress customization, optimization and migration
  • and much more…

    Tools

    • DNS Lookup Tool
    • htdigest Generator Tool Online
    • htpasswd Generator Tool Online
    • HTTP Headers Lookup Tool
    • MD5 Encryption Tool
    • Open Port Check Tool
    • SHA-1 Encryption Tool
    • URL Encoding/Decoding Tool

    Nav

    • Home
    • About Me
    • Contact Me
    • Privacy Policy
    • Sitemap
    Vultr SSD VPS

    Creative Commons License
    Jesin's Blog by Jesin A is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
    Based on a work at websistent.com.