# 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.

Canonical: https://scaplet.com/errors/http/413/nginx

Guide Error · HTTP status codes

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

413 4xx · Client error

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](#the-one-setting-behind-an-nginx-413)
2. [Fix it step by step](#fix-it-step-by-step)
3. [If it still fails: the limits behind nginx](#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 with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F413%2Fnginx%20(%22413%20Request%20Entity%20Too%20Large%20in%20nginx%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F413%2Fnginx%20(%22413%20Request%20Entity%20Too%20Large%20in%20nginx%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F413%2Fnginx%20(%22413%20Request%20Entity%20Too%20Large%20in%20nginx%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fhttp%2F413%2Fnginx%20(%22413%20Request%20Entity%20Too%20Large%20in%20nginx%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

_01_client_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](/glossary/entity) Too Large". The general meaning is on [413 Content Too Large](/errors/http/413). 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.

_02_How 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](/glossary/content-length), 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; } }
```

**Setting 0 removes the check entirely** `client_max_body_size 0;` disables checking of the request body size. Use a real number so a bad client cannot send an unbounded body.

_03_Other limits in the chain

## If it still fails: the limits behind nginx

nginx is often the first of several limits. After you raise it, a request can pass nginx and fail in the next layer.

Layer

### PHP

Setting

`upload_max_filesize`

Documented default

`2M`

Layer

### PHP

Setting

`post_max_size`

Documented default

`8M`

Layer

### nginx

Setting

`client_max_body_size`

Documented default

`1m`

Layer

### nginx

Setting

`client_body_timeout`

Documented default

`60s` between two reads; on expiry nginx returns 408, not 413

PHP'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](/errors/http/413) for the general checklist. For a 400 from the same server, see [400 Bad Request in nginx](/errors/http/400/nginx). A 413 is a 4xx response; [4xx errors](/seo-issues/4xx-errors) covers the crawl side.

Questions

## Asked a lot.

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

_01_ How 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.

_02_ Where 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.

_03_ Why 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.

_04_ Is 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. 01 [RFC 9110: HTTP Semantics](https://www.rfc-editor.org/rfc/rfc9110.html) rfc-editor.org · checked 2026-10-25
2. 02 [nginx: ngx_http_core_module](https://nginx.org/en/docs/http/ngx_http_core_module.html) nginx.org · checked 2026-10-25
3. 03 [nginx source: src/http/ngx_http_request.c](https://github.com/nginx/nginx/blob/master/src/http/ngx_http_request.c) github.com · checked 2026-10-25
4. 04 [PHP manual: Description of core php.ini directives](https://www.php.net/manual/en/ini.core.php) php.net · checked 2026-10-25
5. 05 [PHP manual: List of php.ini directives](https://www.php.net/manual/en/ini.list.php) php.net · checked 2026-10-25
6. 06 [nginx source: src/http/ngx_http_special_response.c](https://github.com/nginx/nginx/blob/master/src/http/ngx_http_special_response.c) github.com · checked 2026-10-25
7. 07 [How HTTP status codes affect Google's crawlers](https://developers.google.com/crawling/docs/troubleshooting/http-status-codes) developers.google.com · checked 2026-10-25

## Keep learning

[All errors](/errors)

[Learn 400 Bad Request in nginx HTTP status codes](/errors/http/400/nginx) [Related HTTP 408 Request Timeout HTTP status codes](/errors/http/408) [Read next 413 Request Entity Too Large HTTP status codes](/errors/http/413) [Do Run a free site audit Free, about two minutes](/site-audit)

Other 413 errors
[413 Request Entity Too Large](/errors/http/413) [413 Request Entity Too Large in Apache](/errors/http/413/apache) [413 Request Entity Too Large in IIS](/errors/http/413/iis) [Vercel 413: FUNCTION_PAYLOAD_TOO_LARGE](/errors/cdn/vercel-payload-too-large) [413 Payload Too Large in Express](/errors/http/413/express)

Nearby in errors
[414 URI Too Long](/errors/http/414)

More in 413 Request Entity Too Large
[413 Payload Too Large in Express](/errors/http/413/express) [413 Payload Too Large in PHP uploads](/errors/http/413/php) [413 Payload Too Large on Cloudflare](/errors/http/413/cloudflare) [413 Request Entity Too Large in Apache](/errors/http/413/apache) [413 Request Entity Too Large in IIS](/errors/http/413/iis) [413 Request Entity Too Large in nginx](/errors/http/413/nginx)

Terms on this page
[Entity](/glossary/entity) [Content-Length (HTTP header)](/glossary/content-length)

Free · 2 minutes

## Tools point. Agencies advise. _This one ships._

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

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **0→7** ChatGPT citations in six weeks Paylane
