nginx's client_max_body_size is smaller than the body
CommonNo limit was set, so the 1m default applies, or a limit was set somewhere less specific than the location the upload goes to. The most specific block wins: a location's own setting overrides the server's, which overrides http's.
Confirm
sudo nginx -T 2>/dev/null | grep -n client_max_body_size sudo grep 'too large body' /var/log/nginx/error.log | tail -5
No setting at all, meaning 1m, or a value below the body size in the block that serves the path, and log lines giving the rejected size
Fix
- Set client_max_body_size in the location that receives uploads, to the largest size you intend to accept.
- Test the configuration and reload, then repeat the failing request.
# in the server or location block that serves the upload path: # client_max_body_size 20m; sudo nginx -t && sudo systemctl reload nginx
nginx -t checks the configuration before the reload, so a typo does not take the site down.