How to Fix WordPress Upload Limits on a VPS (php.ini and Nginx)

You try to upload a 12 MB photo to your WordPress media library and the upload fails with “exceeds the maximum upload size for this site.” The default wordpress upload limit vps setups ship with is often 2 MB, and it comes from PHP, not from WordPress itself. WordPress reads the cap from your server, so to increase wordpress upload size you edit php.ini and Nginx, not a dashboard setting. This guide walks through finding your real limit, raising it in both places, and checking the change actually took effect.

Why the limit is 2 MB on most VPS installs

WordPress does not set an upload cap of its own on a single site. PHP does, through the php.ini upload_max_filesize setting, which defaults to 2 MB in a stock PHP install. On shared hosting the provider raises that value for you. On a VPS you own the config, so the stock value stays until you change it.

There are two layers to the cap. PHP limits the size of a single uploaded file, and Nginx limits the size of the whole HTTP request body. Both have to allow your file, so fixing only one of them leaves the error in place. If you installed WordPress on a LEMP stack yourself, you already touched both config files once, and this fix revisits them. Our LEMP stack install guide shows where each config file lives if you need a refresher.

Check your current limit before changing anything

Open Media > Add New in the WordPress dashboard. The line under the upload box reads “Maximum upload file size: 2 MB” or whatever your server currently allows. That number is the one to beat, and it is the number you re-check after every change below.

For the server side, Tools > Site Health > Info > Server lists the PHP values WordPress sees. From SSH you can also run php -i | grep upload_max_filesize, but watch out: the command line often reads a different php.ini than PHP-FPM does. The CLI result can say 64 MB while the site still shows 2 MB, because the web server uses the FPM config. Always trust the number in Media > Add New over the CLI output.

WordPress upload limit VPS: fix it in php.ini

Find the php.ini file PHP-FPM loads. A quick way is a temporary phpinfo.php file in your site root that calls phpinfo(), then delete it as soon as you have the path. On Ubuntu the FPM config is usually at /etc/php/8.3/fpm/php.ini, with the version number matching your installed PHP.

Edit these four directives:

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
memory_limit = 256M

Three rules matter here. First, post_max_size must be equal to or larger than upload_max_filesize, because the upload travels inside a POST request. A post_max_size smaller than the file size blocks the upload without a clear error. Second, memory_limit should sit above post_max_size, or PHP can run out of memory mid-upload. If you have seen the memory error before, our guide to the allowed memory size exhausted error explains the same setting in more detail. Third, a slow connection needs a longer max_execution_time, or PHP kills the upload before the last bytes arrive.

Save the file and restart PHP-FPM so it reads the new values:

sudo systemctl restart php8.3-fpm

Replace 8.3 with your PHP version. Editing php.ini without restarting the service is the most common reason this fix appears to fail. If your VPS runs more than one PHP version, each site has its own php.ini, so edit the one that belongs to the site you are fixing. Our guide on giving each WordPress site its own PHP version explains how to tell them apart.

Raise the limit in Nginx

Nginx has its own cap, the nginx client_max_body_size directive, and the default is 1 MB. That means Nginx can reject a 12 MB upload with a 413 Request Entity Too Large error even after php.ini allows 64 MB. Open your site config, usually /etc/nginx/sites-available/your-site, and add the directive inside the server block:

server {
    client_max_body_size 64M;
    ...
}

Match the number to the upload_max_filesize you set in php.ini. Setting Nginx higher than PHP is harmless but pointless, since PHP still caps the file. Setting it lower is the mistake that produces the 413 error.

Test the config before reloading, because a typo in the server block can take the whole site down:

sudo nginx -t
sudo systemctl reload nginx

If the test fails, Nginx tells you the file and line number. Fix it and test again. A reload applies the change without dropping active connections, so visitors do not notice it. If a config edit ever locks you out with an access error instead, the steps in our Nginx 403 Forbidden fix cover the usual causes.

The limit still shows 2 MB? Check these

When the dashboard still shows the old number after both edits, work through this list in order.

  • You edited the wrong php.ini. The CLI and FPM configs are separate files. Confirm the loaded file in Site Health or phpinfo, then edit that exact path.
  • PHP-FPM was not restarted. A reload of Nginx alone does nothing for PHP settings. Restart the FPM service for your PHP version.
  • A pool override wins. Check /etc/php/8.3/fpm/pool.d/www.conf for php_admin_value[upload_max_filesize]. Values set with php_admin_value in a pool override anything in php.ini, and they cannot be changed from inside WordPress.
  • A .user.ini file overrides it. PHP-FPM reads .user.ini in the site root. If one exists with a 2 MB value, it beats php.ini for that site.
  • The site runs a different PHP version. On a VPS with several PHP versions, the site may use PHP 8.2 while you edited the 8.3 config. Check which version serves the site before editing again.
  • Multisite has its own setting. On a WordPress multisite network, Network Admin > Settings has a “Max upload file size” field. It still cannot exceed the PHP and Nginx caps, so it only helps once the server limits are already raised.

How big should the limit be?

64 MB covers almost every photo-heavy site. A photographer uploading full-size JPEGs or a shop adding product photos rarely needs more, and 64 MB leaves room for the occasional large file without opening the door to abuse. Go to 128 MB or 256 MB only if the site genuinely handles video or large design files.

Bigger is not free. Every upload ties up a PHP-FPM worker for the whole transfer, and on a small VPS that matters. A 1 GB server uploading several 100 MB files at once can run short of workers and memory, which is the same pressure that causes high CPU usage from WordPress on a 1 GB VPS. Keep memory_limit above post_max_size, keep an eye on free disk space as the media library grows, and consider a dedicated video host instead of pushing large video files through WordPress at all.

Test the new limit

Go back to Media > Add New. The maximum upload size line should now read 64 MB, or whatever value you set. Upload a file just under the new limit, for example a 50 MB test file, and confirm it lands in the library. That confirms the wordpress upload limit vps fix worked on both layers. If it fails, note the exact error: a 413 points at Nginx, while the WordPress “exceeds the maximum upload size” message points at PHP. That distinction tells you which config file to reopen.

FAQ

Can I change the upload limit from the WordPress dashboard?

Not on a single site. There is no upload size field in Settings. Multisite networks have one in Network Admin > Settings, but it cannot raise the limit above what PHP and Nginx allow.

Why does the error persist after I edited php.ini?

Usually one of three things: PHP-FPM was not restarted, the wrong php.ini was edited, or Nginx still caps the request at 1 MB. Check the dashboard number after each fix so you know which layer is still blocking the upload.

Does raising the limit slow down my site?

Not by itself. A higher limit changes nothing until someone uploads a large file. The cost appears only during big uploads, when a PHP-FPM worker stays busy for the whole transfer. On a small VPS, keep the limit as low as the site actually needs.

Ditulis oleh

Firdaus Safari Putra

Founder, PT FirKaizen Digital Solutions

Firdaus Safari Putra adalah founder PT FirKaizen Digital Solutions. Ia membangun dan mengoperasikan infrastruktur server di balik panduan ini, dan menulis berdasarkan apa yang benar-benar ia jalankan, uji, dan ukur — bukan teori.