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.
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:
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.
sudo nginx -t
sudo systemctl reload nginx
nginx -t catches syntax errors before they take down the site — never skip it.

© 2026 Stackstroke. All rights reserved.