NGINX – client intended to send too large body

Going through syslogs I’ve noticed few errors like the one below:

2015/03/03 17:32:27 [error] 11622#0: *2047 client intended to send too large 
body: 1049196 bytes, client: 1.2.3.4, server: subdomain.example.com, request: 
"POST /?/Upload/&s=/_lRQBXpfsulxyH8IKKNAkjcKy5NSC./ HTTP/1.1", host: 
"subdomain.example.com", referrer: "https://subdomain.example.com/"

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.

/etc/nginx/nginx.conf

http {
 ....
 client_max_body_size 100M;
 ....
 }

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

then:

service nginx reload