Nginx Error “client intended to send too large body”

Nginx Error “client intended to send too large body”

Category : How-to

Get Social!

nginx-logoYou may see the below error in your Nginx web server log files, and the good news is it’s easy to fix!

2014/10/26 11:35:15 [error] 15180#0: *12944 client intended to send too large body: 1049290 bytes, client: 185.1.1.14, server: example.jamescoyle.net, request: "POST upload?app,raw HTTP/1.1", host: "example.jamescoyle.net", referrer: "http://example.jamescoyle.net/"

The error is presented because a request being sent to the server contains more data than Nginx allows by default. You can increase the allowed maximum with the client_max_body_size attribute.

You can add the client_max_body_size attribute to your configuration files in multiple places to control what sites or locations the attribute affects.  For example, you can add it to your main config file to ensure than any site can upload the value you set. The below example sets a global value of 50MB for all sites.

vi /etc/nginx/nginx.conf
http {
    client_max_body_size 50M;
...
...
}

You could also add it inside the server { tags of an individual site, or even the location { tags of a specific location.

Once you have made your change remember to reload the configuration and the changes will take effect.

service nginx reload


3 Comments

bellyfat

27-Feb-2015 at 2:27 pm

The below example sets a global value of 50MB for all sites.

Mark

20-Jul-2019 at 7:50 am

Thanks my friend.. your post was a perfect solution for this Nginx newbie :)

GT

15-Dec-2019 at 6:16 am

This was the exact fix I needed. Thank you!

Leave a Reply to Mark Cancel reply

Visit our advertisers

Quick Poll

Do you use GlusterFS in your workplace?

Visit our advertisers