🚀 How to Increase the WordPress Max Upload File Size on a VPS with ISPConfig, Nginx, and OLS

WordPress PHP limit

Are you trying to upload a large file to your WordPress Media Library, only to be stopped by that frustrating 20MB limit? This issue is incredibly common on servers with advanced configurations—such as those where ISPConfig manages Nginx and OpenLiteSpeed/PHP-FPM—because the file size limit is enforced in multiple places simultaneously.

Here is the definitive guide on how to correctly set your maximum upload file size to 200MB (or more).

🧐 Why is the limit 20MB?

In a complex server architecture, where the request passes through the Reverse Proxy (Nginx), hits the web server (OpenLiteSpeed), and is processed by PHP-FPM, the file size limit is controlled at three key levels:

  1. Nginx (Reverse Proxy) Level: The default server-side limit that accepts the initial request. Nginx can reject the file before it even reaches PHP.
  2. PHP-FPM Level: The upload_max_filesize and post_max_size directives.
  3. OpenLiteSpeed (Web Server) Level: OLS’s own request body size limits.

In our case, despite manual changes to the primary php.ini file, the 20MB limit was being overwritten at the Virtual Host configuration level, which is generated by Nginx/ISPConfig and takes precedence.

🛠️ Step-by-Step Solution

To successfully raise the limit, we must elevate it at the Nginx/ISPConfig level and ensure PHP-FPM supports it.

Step 1: Modify the Nginx Directive (The Crucial Action)

Since you are using ISPConfig, the safest way is to introduce the changes via its interface, ensuring they are automatically deployed to your site’s Nginx configuration.

  1. Log into ISPConfig.
  2. Navigate to Sites -> Websites.
  3. Edit (pencil icon) your WordPress site.
  4. Go to the Options tab.
  5. Locate the text field: Nginx Directives.
  6. Enter the following directive, setting your desired size (200MB in this example):client_max_body_size 200M;
  7. Save the changes. ISPConfig will automatically reload the Nginx configuration.

Explanation: The client_max_body_size directive tells Nginx that it may accept a request body of up to 200MB. This was the “gatekeeper” that was previously blocking files larger than 20MB.

Step 2: Increase PHP-FPM Limits (If Necessary)

Although the Nginx directive is often the main blocker, you must ensure PHP is ready for the larger file size.

If ISPConfig does not allow you to edit PHP limits directly in the interface (which is common), use the .user.ini file, which has the highest priority in the PHP configuration hierarchy:

  1. Navigate to the root directory of your WordPress installation (where wp-config.php is located).
  2. Create a file named: .user.ini
  3. Paste the PHP directives into it, also setting 200MB:.user.iniupload_max_filesize = 200M post_max_size = 200M
  4. Execute a restart of the PHP-FPM service (e.g., sudo systemctl restart php8.4-fpm) to ensure the new .user.ini file is read immediately.

Step 3: Check OLS Options (Preventative Measure)

Using OpenLiteSpeed adds another layer. Log into the WebAdmin OLS console (port 7080) and confirm that the server settings are not lower than 200MB:

  • Configuration -> Server -> Tuning.
  • Check Max Request Body Size and set it to 200M or a higher value.

🎉 Summary

Raising the upload limit involves coordinating between three server layers. For advanced ISPConfig configurations, manually entering the Nginx directive is the fastest and most reliable way to overcome the 20MB limit.

Your binary files of up to 200MB can now land in WordPress without a hitch!

Andre Selfie
Andrzej Majewski

My fascination with technology began during my IT studies at the University of Zielona Góra. Since relocating to the UK in 2015 and settling permanently in Bournemouth, I’ve turned that passion into a career dedicated to high-performance infrastructure. I am a Linux enthusiast at heart, a commitment that extends from my professional work at SolutionsInc to my extensive personal homelab. Whether I’m managing complex server architectures via ISPConfig, building VoIP systems with Phones Rescue, or developing automation tools in Python, I thrive on the challenge of crafting efficient, open-source solutions. In 2015, I moved to the UK permanently to expand my professional horizons. Since then, I have established and grown three specialist brands: SolutionsInc (focused on ERPNext systems), SolutionsWeb (bespoke WordPress development and hosting), and Phones Rescue (professional FreePBX-based VoIP solutions).With over 20 years of hands-on technical experience, I pride myself on bridging the gap between complex engineering and practical business efficiency for my clients.

Komentarze

Leave a Reply

Your email address will not be published. Required fields are marked *