When configuring nginx, what considerations affect client_body_buffer_size
?
I've set it to 10m
for a website where users upload photos and image-memes (kind of like 9gag). Note that client_max_body_size
is set to 10m
as well. Overall, my reasoning is that the webserver should accept POST requests with images as big as 10MB (website policy) – and thus both these directives ought to be 10m
.
Is this reasoning correct?
Can someone shed light on the factors affecting what values to set for client_body_buffer_size
, and typical values of client_body_buffer_size
(for the sort of web application I described)?
In case it matters, I utilize nginx as a reverse proxy.
Best Answer
The documentation states what
client_body_buffer_size
does:This memory is in use only while a request is being uploaded; once it is passed on to the backend, the memory is freed again. If a request is larger than this value, it will go to a temporary file and a warning will appear in the error log.
This means that you must have enough RAM to store any simultaneous uploads, or your server will begin swapping.
The performance impact of this is probably not that great, unless you are severely memory constrained and getting lots of uploads at the same time.