The HTTP error 413 Request Entity Too Large
indicates that the client request exceeds the server's configured size limitations.
Common Causes
- Uploading excessively large files
- POST requests containing oversized data payloads
- Server configuration imposing strict request size limits
Solutions
For end users: Reduce the size of files being uploaded.
For server administrators: Adjust Nginx configuration settings.
Edit the nginx.conf
file, adding or modifying within either the http
or server
block:
The client_max_body_size
directive in Nginx controls the maximum allowed client request body size, serving as protection against oversized uploads. Default value is 1m
when unspecified.
client_max_body_size 10m;
This example sets the maximum request body size to 10MB
- requests exceeding this limit will trigger the 413
error.
Supported units for client_max_body_size
:
- Unitless (default bytes)
k
orK
: Kilobytesm
orM
: Megabytesg
orG
: Gigabytes
Remember to restart Nginx after making configuration changes.