If you’re encountering the “413 Request Entity Too Large” error in Nginx, it means the server is rejecting requests that exceed the configured size limit. You can fix this by increasing the client_max_body_size
directive in your Nginx configuration.
Steps to Increase Request Size:
- Edit the Nginx Configuration File
Open your Nginx config file (nginx.conf
or site-specific config in/etc/nginx/sites-available/
):sudo nano /etc/nginx/nginx.conf Or, if modifying a specific site:sudo nano /etc/nginx/sites-available/default - Increase
client_max_body_size
Add or modify the following line inside thehttp
,server
, orlocation
block:client_max_body_size 100M; Adjust the value (100M
) based on your needs. - Save and Exit
- If using
nano
, pressCTRL + X
, thenY
, andEnter
to save.
- If using
- Restart Nginx to Apply Changes
sudo systemctl restart nginx - Verify Configuration
Check if the changes were applied correctly:sudo nginx -t
If you’re also using PHP-FPM, you may need to adjust upload_max_filesize
and post_max_size
in php.ini
.