The Error
When attempting to upload a large theme, plugin, or media file to a WordPress site, you might encounter a blank screen or a specific server response:
413 Request Entity Too Large
This error indicates that the file you are trying to upload exceeds the maximum size limit defined on your web server. While WordPress has its own internal limits, this specific message almost always comes from the server software (usually Nginx) acting as a gatekeeper before the request even reaches WordPress.
Root Cause
The primary culprit is the client_max_body_size directive in Nginx. By default, Nginx often limits file uploads to 1MB. If your ZIP file or high-resolution image is larger than that, the server terminates the connection immediately to protect resources, resulting in the 413 status code.
Secondary causes include PHP configuration limits (upload_max_filesize and post_max_size) or proxy settings if you are using a service like Cloudflare.
Step 1: Modify Nginx Configuration
Since most modern WordPress stacks (like those using LEMP) use Nginx, this is the most effective fix. You need to tell Nginx to allow larger request bodies.
- Connect to your server via SSH.
- Open your Nginx configuration file. Depending on your setup, this might be the main config or a specific site block:
# For global settings
sudo nano /etc/nginx/nginx.conf
# OR for a specific site
sudo nano /etc/nginx/sites-available/yourdomain.com
- Locate the
http,server, orlocationblock. Add or update theclient_max_body_sizedirective. Setting it to 64M is usually sufficient for most WordPress sites:
server {
listen 80;
server_name yourdomain.com;
# Increase upload limit
client_max_body_size 64M;
location / {
...
}
}
- Save the file and test the configuration for syntax errors:
sudo nginx -t
- If the test is successful, reload Nginx to apply changes:
sudo systemctl reload nginx
Step 2: Update PHP Settings
Even after fixing Nginx, PHP might still block the upload if its internal limits are lower than the file size. You need to sync these values.
- Locate your
php.inifile. The path varies by version (e.g., PHP 8.1):
sudo nano /etc/php/8.1/fpm/php.ini
- Search for and modify the following lines:
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
Note: post_max_size should be equal to or larger than upload_max_filesize.
- Restart the PHP-FPM service:
sudo systemctl restart php8.1-fpm
Step 3: Check for Proxy Limits (Cloudflare)
If you use Cloudflare, be aware that the Free plan has a hard limit of 100MB for client uploads. If you are trying to upload a file larger than 100MB, Nginx changes won't help because Cloudflare will trigger a 413 error before the request reaches your server.
In this case, you have two options:
- Upload the file via SFTP/FTP directly.
- Temporarily bypass Cloudflare (Grey Cloud the DNS) while performing the upload.
Verification
To confirm the fix is working:
- Log in to your WordPress Dashboard.
- Go to Media > Add New.
- Look for the text: "Maximum upload file size: 64 MB." If this number has increased from its previous value, your PHP changes are active.
- Try uploading the file that previously failed. It should now process without the 413 error.
Troubleshooting Tips
- Check Permissions: If the 413 error is gone but you get a "Missing a temporary folder" or "Failed to write to disk" error, check your
wp-content/uploadspermissions (usually 755). - Multi-site: If you are on a WordPress Multisite network, there is an additional setting in Network Admin > Settings called "Max upload file size" that can override server settings.
- Theme-level limits: Some poorly coded themes try to set
ini_setvalues infunctions.php. If server-level changes don't work, check if your theme is forcing a lower limit.

