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

Visit our advertisers

Quick Poll

How often do you change the password for the computer(s) you use?

Visit our advertisers