Why is client_max_body_size default set to 1m?

Maxim Dounin mdounin at mdounin.ru
Tue Oct 12 20:50:53 MSD 2010


On Tue, Oct 12, 2010 at 12:22:12PM -0400, jlangevin wrote:

> After migrating one of our servers to Nginx from Apache, I decided to
> test file uploads (as I've implemented the Accelerated Upload Support
> feature in PHP-FPM/nginx). I found that
> [url=http://wiki.nginx.org/NginxHttpCoreModule#client_max_body_size]client_max_body_size[/url]
> is an additional directive that affects POST/upload file sizes.
> So this means that in addition to the 2 directives in PHP that must be
> configured for upload file size, I must also now configure Nginx as
> well?
> I can understand this directive existing, but why default it to 1mb?

It is believed to be reasonably high for non-upload use cases, and 
reasonably low to prevent DoS by uploading large files (with 
default 1 worker processes and 512 worker connections it's possible to 
consume up to 512M in client_body_temp directory).

For upload use cases one is probably going to tune it for his own 
limits anyway - taking into account available disk space and so on.

Maxim Dounin

More information about the nginx mailing list