Free auditStart free
GuideError · HTTP status codes

413 Request Entity Too Large in nginx

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.

3 min
read
7
sources
Oct 23, 2026
updated
Scaplet Editorial Team
author
The short answer

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.

  1. The one setting behind an nginx 413
  2. Fix it step by step
  3. If it still fails: the limits behind nginx
30-second check

Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
01client_max_body_size

The one setting behind an nginx 413

RFC 9110 says the server is refusing to process a request because the request content is larger than the server is willing or able to process. RFC 9110 names it "Content Too Large"; nginx still sends the older wording "Request Entity Too Large". The general meaning is on 413 Content Too Large. In nginx one directive decides it.
Property

Default

Value from the nginx docs
1m
Property

Contexts

Value from the nginx docs
http, server, location
Property

What happens when exceeded

Value from the nginx docs
The 413 (Request Entity Too Large) error is returned to the client
Property

Turn the check off

Value from the nginx docs
Set the size to 0

nginx'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.

02How it works

Fix it step by step

  1. 1

    Confirm it is nginx

    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.

  2. 2

    Set the limit where the upload is handled

    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.

  3. 3

    Reload and retest

    Run nginx -t, then nginx -s reload, and repeat the same request.

Allow 50 MB uploads on one location only
server {
    ...
    location /upload {
        client_max_body_size 50m;
        proxy_pass http://127.0.0.1:8000;
    }
}
Questions

Asked a lot.

4 questions people ask next, answered from the sources on this page.

01How do I fix 413 Request Entity Too Large in nginx?

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.

02Where do I put client_max_body_size?

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.

03Why do I still get an upload failure after raising client_max_body_size?

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.

04Is the 413 error my fault as a visitor?

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.

Sources · 7

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • rfc-editor.org
  • nginx.org
  • github.com
  • php.net
  • google.com
  1. 01RFC 9110: HTTP Semanticsrfc-editor.org · checked 2026-10-25
  2. 02nginx: ngx_http_core_modulenginx.org · checked 2026-10-25
  3. 03nginx source: src/http/ngx_http_request.cgithub.com · checked 2026-10-25
  4. 04PHP manual: Description of core php.ini directivesphp.net · checked 2026-10-25
  5. 05PHP manual: List of php.ini directivesphp.net · checked 2026-10-25
  6. 06nginx source: src/http/ngx_http_special_response.cgithub.com · checked 2026-10-25
  7. 07How HTTP status codes affect Google's crawlersdevelopers.google.com · checked 2026-10-25
Free · 2 minutes

Tools point. Agencies advise. This one ships.

Run the free audit, then approve the fixes. Every change can be undone.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • 0→7 ChatGPT citations in six weeks Paylane