Default
- Value from the nginx docs
1m
Fix an nginx 413 Request Entity Too Large: raise client_max_body_size in the right context, then check PHP upload_max_filesize and post_max_size behind it.
In nginx, a 413 Request Entity Too Large means the request body is larger than client_max_body_size, which defaults to 1m. Raise it in the http, server or location block that handles the upload, reload nginx, and check any other limit behind it, such as PHP's upload_max_filesize and post_max_size.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
1mhttp, server, location413 (Request Entity Too Large) error is returned to the client0nginx's docs add a warning: "browsers cannot correctly display this error". Some browsers therefore show a generic failure or a dropped connection instead of a 413 page. Check the status with curl or the browser's network panel before you decide what happened.
Request the upload with curl -sS -o /dev/null -w "%{http_code}\n" -F "file=@big.bin" https://example.com/upload. A 413 with an nginx page points here. When the request has a Content-Length header, nginx logs the cause at the error level as client intended to send too large body followed by the byte count, so it appears in the default error log.
Put client_max_body_size in the narrowest block that fits. A limit on one location keeps the rest of the site on the 1m default.
Run nginx -t, then nginx -s reload, and repeat the same request.
server {
...
location /upload {
client_max_body_size 50m;
proxy_pass http://127.0.0.1:8000;
}
}upload_max_filesize2Mpost_max_size8Mclient_max_body_size1mclient_body_timeout60s between two reads; on expiry nginx returns 408, not 413PHP's manual says post_max_size also affects file upload and that, to upload large files, it must be larger than upload_max_filesize. If post data exceeds post_max_size, $_POST and $_FILES are empty, which looks like a failed upload without a 413. Set nginx at least as high as PHP's post_max_size. If another server or a CDN sits in front of nginx, it has its own limit; see 413 Content Too Large for the general checklist. For a 400 from the same server, see 400 Bad Request in nginx. A 413 is a 4xx response; 4xx errors covers the crawl side.
4 questions people ask next, answered from the sources on this page.
Set client_max_body_size to a value above your largest upload, in the http, server or location block that serves it, then run nginx -t and reload. The default is 1m.
The docs list the http, server and location contexts. Use a location block for one upload endpoint, or the server block for a whole site.
Another limit may be lower. PHP's upload_max_filesize defaults to 2M and post_max_size to 8M, and a CDN or proxy in front of nginx can have its own cap.
Only in the sense that your file is bigger than the site allows. Reduce the file size, or ask the site owner to raise the server's limit.
Run the free audit, then approve the fixes. Every change can be undone.