413
nginx
config_error
ai_generated
true
413 Request Entity Too Large: client intended to send too large body: 2097152 bytes exceeds client_max_body_size
ID: nginx/client-body-buffer-size-exceeded-with-413
95%Fix Rate
90%Confidence
1Evidence
2024-01-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| nginx 1.24.0 | active | — | — | — |
| nginx 1.25.3 | active | — | — | — |
| nginx 1.26.0 | active | — | — | — |
Root Cause
The HTTP request body size exceeds the limit set by the client_max_body_size directive in nginx configuration.
genericOfficial Documentation
https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_sizeWorkarounds
-
95% success Increase client_max_body_size in the http, server, or location block. Example: http { client_max_body_size 10m; }
Increase client_max_body_size in the http, server, or location block. Example: http { client_max_body_size 10m; } -
85% success If using a reverse proxy, also ensure the upstream server (e.g., PHP-FPM, Node.js) has matching body size limits. For PHP-FPM, edit php.ini: upload_max_filesize = 10M post_max_size = 10M
If using a reverse proxy, also ensure the upstream server (e.g., PHP-FPM, Node.js) has matching body size limits. For PHP-FPM, edit php.ini: upload_max_filesize = 10M post_max_size = 10M
中文步骤
Increase client_max_body_size in the http, server, or location block. Example: http { client_max_body_size 10m; }If using a reverse proxy, also ensure the upstream server (e.g., PHP-FPM, Node.js) has matching body size limits. For PHP-FPM, edit php.ini: upload_max_filesize = 10M post_max_size = 10M
Dead Ends
Common approaches that don't work:
-
Increase client_body_buffer_size only
90% fail
The error is about client_max_body_size, not client_body_buffer_size. Buffer size is separate from the maximum allowed body size.
-
Set client_max_body_size in a location block without specifying the server block
50% fail
If the location block is inside a server block that has a smaller limit, the server block limit may still apply depending on inheritance. Must set at http, server, or location level correctly.
-
Increase system file descriptor limits
100% fail
This is a request size limit, not a file descriptor issue.