Nginx refuses request bodies over 1MB by default. Uploads fail with 413 even though your app would accept them — the limit must be raised where Nginx terminates the request.
Unless you raise it, Nginx rejects bodies >1MB at the edge. Your app never sees the request — there's nothing to debug in the app.
client_max_body_size in a location block that doesn't match the upload route, or a server block overriding the http-level value. nginx -T shows the effective merged config.
sudo nginx -T 2>/dev/null | grep -n client_max_body_size
# in the relevant server or location block:
# client_max_body_size 50m;
sudo nginx -t && sudo systemctl reload nginx
# behind a proxy also set: proxy_request_buffering off; # or size app/PHP limits (php: upload_max_filesize, post_max_size)
Behind Cloudflare, free-plan uploads also cap at 100MB — 413 from Cloudflare mentions cloudflare in the response headers. Raising limits too high invites abuse; scope the directive to the specific upload location.
The directive is probably in the wrong context — check nginx -T for the merged effective value on your exact server/location, and confirm another server block isn't handling the request. Then reload nginx; a restart isn't needed.
No — it only limits request body size (uploads, POSTs). Raising it doesn't change behavior for typical GET requests.
Our most-documented failures, packaged as ready-to-ship starter kits: Docker, Kubernetes, and Terraform.
Browse the template store →One-time. Yours to modify. Instant download from the NinjaOps template store.