Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
WordPress uploads can be blocked by several independent parts of an Ubuntu server: an upstream proxy, Nginx, PHP-FPM, WordPress settings, temporary storage, filesystem permissions, or image processing. Match the error to the layer first; raising PHP’s file limit will not fix an Nginx 413 or an unwritable uploads directory.
Match the error to the likely cause
| What you see | Likely layer | First check |
|---|---|---|
| HTTP 413, “Request Entity Too Large” | Nginx or an upstream proxy | client_max_body_size; check proxy or CDN limits if the request does not reach Nginx. |
| “The uploaded file exceeds the upload_max_filesize directive in php.ini” | PHP-FPM | upload_max_filesize in the configuration used by FPM. |
| Empty POST data or a request that fails without a clear size message | PHP-FPM | post_max_size, which applies to the whole request. |
| “Unable to create directory” | WordPress path or filesystem | Configured upload path, directory existence, ownership, and permissions. |
| “The uploaded file could not be moved” | Temporary directory or destination filesystem | FPM’s upload temporary directory, disk space, and destination write access. |
| HTTP 502 | Nginx-to-FPM connection or PHP-FPM | FPM service state, socket path and permissions, and service logs. |
| HTTP 500 or a failure after a long wait | PHP, timeout, storage, or image processing | Nginx and FPM logs; check timeouts, available disk space, and PHP errors. |
| File appears in Media Library, but thumbnails or metadata are missing | Image processing | GD or ImageMagick, PHP memory, disk space, image dimensions, and format-specific errors. |
Nginx’s client_max_body_size limits the request body and returns 413 when the request exceeds it. Nginx documents a default of 1 MB, but included configuration, hosting tools, or a more specific setting may change the effective value. The directive can be set in http, server, or location context. See the Nginx core module documentation.
Identify the active Nginx site and PHP-FPM version
Ubuntu can have separate PHP configurations for command-line use, Apache, and PHP-FPM. A value shown by the php command does not prove that a browser request to WordPress uses that configuration. First find the FPM service and the socket used by the site:
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutephp -v
php --ini
systemctl list-units --type=service 'php*-fpm.service'
ls -d /etc/php/*/fpm 2>/dev/null
sudo nginx -T | grep -n -E 'server_name|root |fastcgi_pass|client_max_body_size'
grep -R "fastcgi_pass" /etc/nginx/sites-enabled /etc/nginx/sites-available
Common Ubuntu package paths include /etc/php/<version>/fpm/php.ini, /etc/php/<version>/fpm/pool.d/www.conf, and /run/php/php<version>-fpm.sock. Treat them as starting points, not guarantees: custom builds, containers, hosting panels, and named FPM pools can use other paths and service names. The fastcgi_pass socket in the site’s Nginx configuration must match the socket provided by the active FPM service.
#1 Best Overall
- Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
For example, if discovery shows PHP 8.3, inspect that service rather than assuming the version:
sudo systemctl status php8.3-fpm --no-pager
sudo journalctl -u php8.3-fpm -n 100 --no-pager
Replace 8.3 below with the version actually serving the site. If multiple sites or pools use different versions, identify the relevant virtual host and pool before editing configuration.
Raise Nginx’s request-body limit when it returns 413
For a single site, a per-site limit avoids increasing the request size accepted by unrelated applications on the server. Back up the relevant configuration before editing it:
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →sudo cp /etc/nginx/sites-available/example.com
/etc/nginx/sites-available/example.com.bak.$(date +%F-%H%M%S)
sudo nano /etc/nginx/sites-available/example.com
Put client_max_body_size inside the site’s server block. This 128 MB setting is an example, not a universal recommendation:
server {
server_name example.com www.example.com;
root /var/www/example.com/public;
client_max_body_size 128M;
# Existing WordPress and PHP configuration follows...
}
Check the configuration before reloading Nginx:
sudo nginx -t
sudo systemctl reload nginx
If Nginx still returns 413, inspect the complete active configuration rather than only the file you edited:
sudo nginx -T | grep -n -C 3 client_max_body_size
A more specific location setting can change the effective limit. If Nginx logs show no request when you reproduce the error, a CDN, WAF, load balancer, control panel, or other proxy in front of it may be rejecting the request first. WordPress’s Nginx guidance also includes this directive in server configuration.
Set PHP-FPM upload and request limits
Edit the PHP-FPM configuration, not the CLI configuration. For a typical PHP 8.3 Ubuntu package, the file is /etc/php/8.3/fpm/php.ini:
Recommended Free Tools
sudo cp /etc/php/8.3/fpm/php.ini
/etc/php/8.3/fpm/php.ini.bak.$(date +%F-%H%M%S)
sudo nano /etc/php/8.3/fpm/php.ini
Use values appropriate to the site’s actual files and server capacity. For example:
Rank #2
- Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
file_uploads = On
upload_max_filesize = 128M
post_max_size = 136M
memory_limit = 256M
max_execution_time = 300
max_input_time = 300
max_file_uploads = 20
upload_max_filesizelimits one uploaded file.post_max_sizelimits the complete POST request, including multipart form overhead and other fields. Set it at least as high asupload_max_filesize, with headroom. WordPress recommends keeping the POST limit above the file limit in its PHP performance guidance; PHP documents the directives in its core configuration reference.max_file_uploadslimits how many files PHP accepts in one request.memory_limit,max_execution_time, andmax_input_timecan matter for large requests and image processing, but raising them does not resolve every upload failure.
A practical sizing relationship is memory_limit > post_max_size > upload_max_filesize, but this is a guideline rather than a guaranteed resource formula: actual memory use depends on what WordPress and its image-processing libraries do with the file. WordPress’s FAQ discusses PHP and WordPress limits.
After changing FPM’s PHP settings, restart the matching service so its workers reread the configuration:
sudo systemctl restart php8.3-fpm
Do not expect an Nginx reload alone to apply PHP changes. Check the service if it does not restart cleanly:
sudo systemctl status php8.3-fpm --no-pager
sudo journalctl -u php8.3-fpm -n 100 --no-pager
Verify the values WordPress receives
Check through the website itself; a shell command reads the CLI SAPI and may report different values from FPM. To verify FPM directly, create a temporary file in the site’s document root, for example /var/www/example.com/public/php-upload-check.php:
<?php
header('Content-Type: text/plain');
foreach ([
'upload_max_filesize',
'post_max_size',
'memory_limit',
'max_execution_time',
'max_input_time',
'max_file_uploads',
'upload_tmp_dir',
'file_uploads'
] as $key) {
printf("%s = %sn", $key, ini_get($key));
}
Open the file over the same domain and HTTPS endpoint used for WordPress, compare the output with the intended FPM values, then remove it immediately:
sudo rm /var/www/example.com/public/php-upload-check.php
Do not leave a diagnostic file publicly accessible. An alternative CLI check can be useful for command-line PHP, but it does not verify FPM:
php -r 'foreach (["upload_max_filesize","post_max_size","memory_limit","max_execution_time","max_input_time","upload_tmp_dir"] as $k) echo "$k = ".ini_get($k).PHP_EOL;'
WordPress’s Media Library or Site Health can also help show the limit visible to WordPress, but use the browser-side check when you need to distinguish FPM configuration from CLI configuration.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsCorrect the uploads path and write permissions
“Unable to create directory” or “could not be moved” can indicate a path or permission problem, but confirm the actual path and FPM user before changing ownership. WordPress may use a customized content or upload path. Check the site’s configuration and directories:
Rank #3
- Easily store and access 1TB to content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop. Reformatting may be required for Mac
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
grep -nE "define( *['"](ABSPATH|WP_CONTENT_DIR|UPLOADS)" /var/www/example.com/public/wp-config.php
sudo ls -ld /var/www/example.com/public/wp-content
sudo ls -ld /var/www/example.com/public/wp-content/uploads
Create the uploads directory if it is missing:
sudo install -d /var/www/example.com/public/wp-content/uploads
Ubuntu’s packaged FPM pools commonly use www-data, but verify the pool serving this site:
grep -E '^(user|group)s*=' /etc/php/8.3/fpm/pool.d/www.conf
If the intended pool user is www-data and this is a simple single-site setup, a common ownership and mode arrangement is:
sudo chown -R www-data:www-data /var/www/example.com/public/wp-content/uploads
sudo find /var/www/example.com/public/wp-content/uploads -type d -exec chmod 755 {} ;
sudo find /var/www/example.com/public/wp-content/uploads -type f -exec chmod 644 {} ;
Test write access as the verified pool user, substituting that user if it is not www-data:
sudo -u www-data test -w /var/www/example.com/public/wp-content/uploads
&& echo writable || echo not-writable
Do not use chmod -R 777 as a routine fix. WordPress warns that excessively permissive upload-directory permissions can let an attacker upload or modify executable content; see its file permissions guidance.
- For a developer-managed deployment, consider a shared group or ACL so deployment ownership and FPM write access work together.
- For multiple sites, keep each site’s PHP-FPM pool from writing to another site’s files.
- For containers, check the mounted volume’s UID/GID and container permissions as well as the host path.
If Unix ownership and modes appear correct but writes still fail, check ACLs, read-only mounts, AppArmor or other security controls, and systemd service restrictions. Nginx’s read access to files is separate from PHP-FPM’s need to write uploads.
Check PHP’s temporary upload directory and disk space
PHP first receives the file in a temporary location; WordPress then moves it into its upload directory. A failure at either stage can look like an upload-directory problem. Check available space and inodes, including the temporary and destination filesystems:
df -h
df -i
df -h /tmp /var/www/example.com/public/wp-content/uploads
Inspect upload_tmp_dir through the FPM diagnostic file. A shell check such as the following is useful only for the CLI SAPI:
php -i | grep -E 'upload_tmp_dir|sys_temp_dir'
Do not change the temporary directory unless the effective value or logs point to it. If a custom directory is needed, create one writable by the FPM pool user; for a pool running as www-data, for example:
Rank #4
- Easily store and access 4TB of content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
sudo install -d -o www-data -g www-data -m 750 /var/lib/php/uploads
Set it in the relevant FPM PHP configuration and restart FPM:
upload_tmp_dir = /var/lib/php/uploads
sudo systemctl restart php8.3-fpm
Disk exhaustion, inode exhaustion, permissions on /tmp, systemd sandboxing, and security policy can all prevent temporary-file writes. A custom upload_tmp_dir will not fix those underlying causes by itself.
Use logs to investigate 500, 502, and delayed failures
Reproduce the problem while checking logs so you can connect the error to the request:
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →sudo tail -f /var/log/nginx/error.log
sudo tail -f /var/log/nginx/access.log
sudo journalctl -u php8.3-fpm -f
Also check the PHP-FPM pool’s configured error log, if it differs from the journal, and the system log:
sudo journalctl -xe
client intended to send too large body: correct the effective Nginx or upstream request-body limit.upstream timed out: investigate slow PHP execution, image processing, storage, or the applicable FastCGI timeout before increasing it.connect() to unix:/run/php/... failed: check whether FPM is running, whether the socket path matches Nginx’sfastcgi_pass, and whether socket permissions allow the connection.Primary script unknown: check the Nginx document root and PHPSCRIPT_FILENAMEhandling.Permission denied: check directory traversal and write access, ACLs, and security restrictions.No space left on device: check disk space and inodes on the affected filesystem, including temporary storage.
If logs show that a valid large upload is accepted but PHP takes longer than Nginx will wait, a site-specific FastCGI read timeout may be appropriate. Confirm the relevant PHP location and socket before adapting this example:
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_read_timeout 300s;
}
This is a conditional change, not a default. Longer timeouts can tie up workers and make a busy server less responsive. Increasing max_execution_time in PHP does not automatically change Nginx’s FastCGI timeout.
Separate file transfer failures from image-processing failures
If the media file reaches WordPress but thumbnails or metadata do not appear, the request-size limit may already be working. WordPress may need to decode and resize the image, which can expose missing extensions, memory pressure, format restrictions, or storage problems. Check installed modules and available resources:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
php -m | grep -Ei 'gd|imagick|exif|fileinfo'
free -h
df -h
The module list shown by the shell is for CLI PHP; verify the web-serving FPM environment if it differs. Use logs to determine whether GD or ImageMagick rejected the format or encountered a policy restriction. A practical test sequence is a small JPEG and a small PNG, then the problematic image. If the small files process but one format or very large image fails, investigate that format, its dimensions, ImageMagick policy, PHP-FPM memory, and free disk space.
Best Value
- [Upgraded Version] - This external hard drive features a mirrored logo stripe combined with a striped anti-slip design, and the rounded corners of the casing make it easier to grip. The stripes also have a heat dissipation function, ensuring stable and fast data transfer.
- 【Ultra-thin and quiet】 - The motherboard adopts JMicron 578 noise-free solution, giving you a quiet working environment. Lightweight and portable size designed to fit in your pocket for easy portability.
- 【Ultra-Fast Data Transfers】 - Pairing this external hard drive with JMicron 578 solution USB 3.0 and USB 2.0 interfaces enables blazing-fast data transfer. It boasts theoretical read speeds of up to 125MB/s and write speeds of up to 103MB/s.
- 【Plug and Play】 - With no software to install, just plug it in and the drive is ready to use.The hard disk chip is wrapped with an aluminum anti-interference layer to increase heat dissipation and protect data.
- 【What You Get】 - 1 x Portable Hard Drive, 1 x USB 3.0 Cable, 1 x User Manual, Gift-type shell packaging ,Three-year manufacturer's warranty and free technical support services.
Raise FPM’s memory limit only when the failure and workload justify it. WordPress memory constants such as WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT can request memory for WordPress contexts, but they cannot override a PHP-FPM limit that prevents the process from using more. Installing or enabling GD or ImageMagick may help when the needed extension is absent, but it is not a universal fix.
Check WordPress, multisite, and plugin-specific restrictions
Once Nginx, PHP-FPM, and filesystem access are working, check the limits WordPress applies to the site. The upload-size figure in the Media Library can show what WordPress currently sees; compare it with the browser-side FPM values rather than assuming it sets the server’s maximum.
- Multisite: Network Admin settings can impose a maximum upload size and a site storage limit. Multisite sites can also use site-specific upload paths, which must be writable by the pool serving them.
- Memory constants:
WP_MEMORY_LIMITandWP_MAX_MEMORY_LIMITaffect WordPress memory requests; they do not raise Nginx’s body limit or PHP’s upload and POST limits. - Plugins: Security, media-management, optimization, and membership plugins can impose file-size, MIME-type, or directory rules. Review their settings and logs if the server accepts the request but WordPress refuses it.
WordPress’s upload handler reference describes upload handling and PHP-related errors; its FAQ covers PHP limits and multisite considerations.
Free tools Windows power users keep installed
One-click scans. No signup required.
Avoid fixes meant for a different web server
Instructions that add Apache directives such as php_value upload_max_filesize to .htaccess do not configure Nginx: Nginx does not read .htaccess files. For Nginx with PHP-FPM, set PHP values in the active FPM configuration or an appropriate pool configuration. A .user.ini file is an option only where the deployment supports it, and not every directive can be changed there. Do not paste Apache directives into an Nginx configuration file. WordPress support material discusses server-dependent approaches; see its pre-defined replies and Nginx guidance.
Change one authoritative setting at a time, validate or restart the service that reads it, and verify the effective value through the web request. Editing several PHP configuration locations at random makes it harder to find which setting actually controls the site.
Verify the repair with progressively larger uploads
- Confirm the intended virtual host and PHP-FPM service are active, and that Nginx’s configured socket matches the serving FPM pool.
- Confirm Nginx accepts the required request size and the browser-side FPM diagnostic shows the expected PHP limits.
- Confirm the uploads destination and PHP temporary directory exist, are writable by the correct pool user, and have enough disk space and inodes.
- Upload a small JPEG, then a file just below the required size, followed by one near that size. Try another permitted format if format-specific processing is in question.
- Check that WordPress creates thumbnails and metadata, and inspect Nginx and FPM logs if any test fails.
- Delete the temporary diagnostic PHP file.
Choose limits only as large as the site needs. Large requests use temporary storage, take longer to process, can increase PHP-FPM resource pressure, and can increase exposure to abusive traffic. For very large videos or backups, direct object-storage uploads or a dedicated media workflow may be a better design than sending every file through the WordPress administration interface.
When the failure is outside the WordPress server
If the request does not appear in Nginx’s access or error logs, check the path before Nginx: a CDN, WAF, load balancer, hosting panel, or other reverse proxy can have its own body-size and timeout limits. For containerized deployments, inspect the mounted volume and the container’s PHP configuration. On servers with several FPM pools, verify the pool’s user, socket, and PHP settings for the affected virtual host rather than changing another site’s pool.
If administering Nginx, PHP-FPM, storage, and permissions is itself the recurring problem, managed WordPress hosting may reduce server-maintenance work, though it can limit low-level customization. If a large media library is straining local disk or backups, object storage or a media-offload workflow may help, but requires integration, access-control design, and compatibility testing. Neither is a first-line fix for a single misconfigured limit or permission.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

