Nginx Configuration Settings : Upload Limits, Timeouts & More

Learn the essential Nginx configuration settings — upload limits, timeouts, buffers, and worker tuning — with real nginx.conf examples for Ubuntu.

Nginx configuration settings ship conservative by default — a 1MB upload cap, 60-second timeouts — and that starts causing problems the moment you upload a real file or proxy a slower backend. Here’s how to fix both.

Global Config (applies to all sites)

Edit the main config:

				
					sudo nano /etc/nginx/nginx.conf
				
			

Add this inside the http { } block:

				
					# Upload limit
client_max_body_size 64M;

# Timeouts
client_body_timeout   30s;
client_header_timeout 30s;
keepalive_timeout     65s;
send_timeout          30s;
				
			

Add this inside the http { } block:

Nginx Configuration

Want It for One Site Only Instead?

Don’t touch nginx.conf — put it in that site’s file so it doesn’t apply globally:

				
					sudo nano /etc/nginx/sites-available/yoursite
				
			
				
					server {
    listen 80;
    server_name example.com;

    # Upload limit
    client_max_body_size 64M;

    # Timeouts
    keepalive_timeout 65s;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_read_timeout 60s;   # raise this for slow backend routes
    }
}
				
			

Anything set here overrides the global value from nginx.conf — but only for this site.

Apply the Changes

				
					sudo nginx -t
sudo systemctl reload nginx
				
			

nginx -t catches syntax errors before they take down the site — never skip it.

ON THIS PLACE