Nginx
Mar 19, 2026 3 min read

Fix Nginx 413 Request Entity Too Large

Allow larger uploads by raising `client_max_body_size` in the right server block.

Problem

POSTing a file larger than ~1 MB returns `413 Request Entity Too Large`.

Root cause

Nginx defaults `client_max_body_size` to 1 MB. Any larger request body is rejected before reaching the upstream.

Solution

Raise the limit in the right scope

nginx
http {
  client_max_body_size 50m;   # global default
}

server {
  client_max_body_size 200m;  # override for this vhost
}

Reload Nginx

bash
sudo nginx -t && sudo systemctl reload nginx

Frequently asked questions

Related fixes

Weekly digest

One DevOps fix in your inbox each week

Short, practical, no fluff. Real errors, real fixes — straight from production postmortems.