Web / NGINX Interview questions
How can you optimize NGINX buffer settings for large file uploads?
client_max_body_size 100M; client_body_buffer_size 128k; client_body_timeout 60s;
client_max_body_size sets the hard ceiling on upload size; requests larger than this are rejected outright with a 413 before consuming resources unnecessarily. client_body_buffer_size controls how much of the body NGINX holds in memory before spilling the rest to a temporary file on disk - setting it too low forces disk writes for uploads that would otherwise fit comfortably in memory, while setting it too high wastes memory on many small, simultaneous uploads.
client_body_timeout matters for slow uploads over weak connections, preventing a stalled client from holding a worker's attention indefinitely. For very large uploads, it's also common to increase proxy_read_timeout and proxy_send_timeout if the request is being proxied to a backend that needs time to process the file.
More Related questions...