Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk9 min

How to Configure Virtualmin with Nginx and PHP (LEMP and PHP-FPM Guide)

A practical Virtualmin LEMP guide covering prerequisites, the automated Nginx installer, PHP-FPM pools, mini versus full installations, and the careful Apache-to-Nginx migration sequence.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a new Virtualmin server, install the LEMP bundle on a fresh, supported operating system and run PHP through PHP-FPM. The documented installer command is sudo sh virtualmin-install.sh --bundle LEMP. Plan for at least 1 GiB of RAM for a basic installation, or about 4 GiB or more when you need the full mail, spam-filtering and virus-scanning stack. Point your domain’s DNS records at the server before creating production sites.

Do not install the Apache-based LAMP bundle expecting to switch later. Virtualmin describes changing the LAMP/LEMP choice after installation as significant manual work. If Apache is already serving sites, treat conversion to Nginx as an advanced migration rather than a simple checkbox change.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the Virtualmin LEMP setup contains

LEMP is Virtualmin’s name for a Linux, Nginx, MariaDB and PHP hosting stack. Nginx handles HTTP and HTTPS requests, PHP-FPM executes PHP scripts, and MariaDB provides the database service used by many PHP applications. Virtualmin’s automated installer configures the package manager and required dependencies, which is why it is the preferred route for a new server.

The key design choice is the web server selected during installation. A fresh LEMP deployment gives each virtual server an Nginx configuration and a PHP-FPM-compatible execution path. An existing Apache deployment has additional services and domain features that must be disabled or reconfigured before Nginx can take over.

Choose the path before installing

Situation Recommended approach Why
New server with no production sites Automated Virtualmin installation with the LEMP bundle Virtualmin configures dependencies and avoids a later web-server conversion.
Existing Apache-based Virtualmin server Planned Apache-to-Nginx migration Apache, website features and dependent Virtualmin features must be changed in a controlled order.
Small web-only server LEMP with the --type mini option Skips several local hosting services and retains the web stack.
Mail, spam filtering and virus scanning on the same host Full installation The broader stack needs materially more memory than a basic or mini deployment.

Requirements before you run the installer

Use a fresh supported operating system

Start with a clean installation of an operating system supported by the current Virtualmin release. Apply current security updates, set the server’s hostname correctly, and make sure you have administrative access. The installation command uses sudo, so the account must be able to obtain root privileges.

Size memory for the services you will run

Installation scope Memory guidance What that means
Basic Virtualmin installation At least 1 GiB RAM Virtualmin’s documented minimum for a basic install; actual workload capacity depends on the sites and processes you add.
Full hosting installation About 4 GiB RAM or more Allows room for mail handling, spam filtering and virus scanning in addition to the web stack.
Mini web-only installation No separate figure stated It removes several services, but PHP applications and traffic still determine the practical requirement.

These are Virtualmin’s installation guidance figures, not a guarantee that any particular application will run comfortably. A busy PHP site, a database workload or several PHP-FPM pools can require more memory than the installation itself.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Prepare DNS

Create DNS records that point the domain and any hostnames you will use to the server before putting sites online. If DNS still points elsewhere, the installation may succeed while visitors continue reaching the old host. Allow time for TTLs and cached records to expire when moving an established domain.

Install a new Virtualmin server with Nginx

1. Confirm the preflight conditions

  • The operating system is fresh, supported and patched.
  • The server has at least 1 GiB of RAM for a basic installation, or about 4 GiB or more for the full mail-enabled stack.
  • You have root or working sudo access.
  • DNS records for the intended domains point to this server.
  • No production Apache configuration needs to be preserved on this host.

2. Run the documented LEMP installer

From the directory containing the installer, run:

sudo sh virtualmin-install.sh --bundle LEMP

The installer configures the package manager and required dependencies. In its selection interface, choose the Nginx (LEMP) option deliberately; do not accept an Apache/LAMP choice if Nginx is your intended web server.

3. Use the mini profile only when you do not need local hosting services

For a lighter web-only server, Virtualmin documents the --type mini option. The corresponding LEMP form is:

sudo sh virtualmin-install.sh --bundle LEMP --type mini

The mini profile skips local mail handling, spam and virus filtering, local DNS, FTP and Jailkit while retaining the web stack. Choose it only when those services will be provided elsewhere or are intentionally not required. Adding the omitted services later changes the server’s role and resource needs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Complete the installer and create a virtual server

Follow the installer’s prompts to finish the base configuration. After the control panel is available, create a virtual server for a domain whose DNS already resolves to this host. Select Nginx for the website and PHP-FPM for PHP execution when those choices are presented. The exact screen labels can vary by Virtualmin version, but the decisive settings are the Nginx website feature and an enabled PHP-FPM mode rather than Apache’s mod_php.

5. Test the request path

Check the domain over HTTP and HTTPS, then test a small PHP page from the site’s document root. Remove the test page after confirming it works; do not leave a page that exposes server information on a public site. If the domain shows a default page, verify DNS first, then verify that the virtual server’s Nginx feature is enabled and that the site’s document root contains the requested file.

Why PHP-FPM is the right PHP mode for Nginx

Virtualmin recommends PHP-FPM because each website can have its own process pool. That separation improves isolation, security, stability and resource management in shared hosting. Nginx passes PHP requests to the appropriate FPM pool instead of loading PHP through Apache’s mod_php model.

Separate pools also give you a boundary for diagnosing a single site’s failures. A runaway application can consume that site’s workers without automatically sharing the same PHP process pool as every other virtual server. Pool limits still need to be chosen sensibly; isolation does not remove the need to monitor memory and request volume.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Enable PHP-FPM for each Nginx site

  1. Open the virtual server’s website or PHP feature settings in Virtualmin.
  2. Confirm that the Nginx website feature is enabled for the domain.
  3. Select PHP-FPM as the execution mode, rather than an Apache-specific PHP mode.
  4. Save the virtual-server configuration and reload or restart the affected services through the control panel when prompted.
  5. Test both a static file and a PHP file. A static response confirms Nginx is serving the site; a successful PHP response confirms the Nginx-to-FPM handoff.

Understand the two levels of PHP configuration

Virtualmin cautions that changing the system-wide /etc/php.ini does not automatically change every virtual server’s individual php.ini. A setting in the global file can therefore appear to have no effect on a domain that has its own PHP configuration.

Use the individual virtual server’s PHP settings when a change is intended for one site. When a setting should propagate across domains for a particular PHP version, use that version’s additional .ini files as supported by the operating system and PHP packaging. After changing a PHP setting, test the target site and confirm that the value is being read by the same PHP-FPM version that serves web requests.

Switch an existing Apache Virtualmin server to Nginx

Virtualmin labels this conversion technically complex. The order matters because Apache website definitions and dependent features can continue to expect Apache even after Nginx packages are installed. Plan a maintenance window, keep a backup of configuration and data, and test one non-critical virtual server before attempting a broad conversion.

1. Inventory what Apache-dependent features you use

List every existing virtual server and note whether it uses Apache website handling, status pages, Awstats, htpasswd authentication or another feature tied to Apache. These dependencies may need to be disabled, replaced or reconfigured. Do not assume that installing Nginx automatically translates all existing Apache directives.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Disable Apache and its website features

Disable the Apache service before enabling Nginx. On Debian-derived systems the service is normally named apache2; on Enterprise Linux systems it is normally httpd. Use the service-management tools for your distribution to stop it and prevent it from starting automatically. Then disable the Apache website feature and other dependent Virtualmin features for the affected domains.

Do not run both servers on the same HTTP and HTTPS ports unless you have deliberately designed a proxy arrangement. A port conflict can leave Nginx stopped or make the migration appear successful while requests still reach Apache.

3. Install Nginx and the Virtualmin Nginx modules

Install the packages matching your operating-system family. Virtualmin’s documented package names are:

Operating-system family Nginx and Virtualmin packages
Debian derivatives nginx-full, webmin-virtualmin-nginx, webmin-virtualmin-nginx-ssl
Enterprise Linux systems nginx, webmin-virtualmin-nginx, webmin-virtualmin-nginx-ssl

Use the distribution’s package manager to install those packages and resolve dependencies. Keep the package source aligned with the supported operating system; mixing repositories or major versions can produce incompatible Nginx, PHP-FPM or Webmin components.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Register Nginx with Virtualmin

Run the documented configuration command:

sudo virtualmin-config-system --include Nginx

This adds the Nginx components to Virtualmin’s system configuration. It does not, by itself, guarantee that every existing virtual server has been converted.

5. Enable the global Nginx features

Enable the global virtualmin-nginx and virtualmin-nginx-ssl features in Virtualmin. These provide the Nginx website and SSL capability at the Virtualmin level.

6. Enable Nginx features per virtual server

For each existing domain, enable the Nginx website and Nginx SSL features. Check the generated configuration, document root, certificate settings and PHP-FPM selection before moving the domain’s DNS. A site that depends on Apache-only directives may require application or configuration changes because Nginx does not interpret Apache configuration syntax.

7. Revisit dependent services

Status reporting, Awstats and htpasswd are examples of features that may need attention during the migration. Confirm their Nginx-compatible configuration or leave them disabled until you have a tested replacement. Record each exception so a future administrator does not re-enable an Apache-dependent feature accidentally.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Full versus mini LEMP installations

Capability Full installation Mini installation
LEMP web stack Included Retained
Local mail handling Included in the broader hosting stack Skipped
Spam and virus filtering Included in the broader hosting stack Skipped
Local DNS Included Skipped
FTP Included Skipped
Jailkit Included Skipped
Memory guidance About 4 GiB or more for the full stack No separate Virtualmin figure stated; workload determines the need

A mini installation is not a faster version of the full stack; it is a different service profile. It suits a server whose mail, DNS, file transfer and filtering are external or unnecessary. If you need Virtualmin to provide those services locally, select the full installation and size the server accordingly.

Troubleshoot common failures

The installer selected Apache

Stop before creating sites and check the bundle choice. The LAMP/LEMP selection is difficult to reverse after installation. For a new server, rebuilding on a fresh supported operating system is usually safer than attempting an improvised conversion.

Nginx will not start after migration

  • Confirm that Apache (apache2 or httpd) is stopped and disabled.
  • Check for another process already using the HTTP or HTTPS ports.
  • Verify that the Nginx and Virtualmin Nginx module packages are installed for the correct operating-system family.
  • Inspect the generated virtual-server configuration for syntax errors or directives copied from Apache that Nginx cannot parse.

A PHP page downloads or returns an error

  • Confirm that the domain has the Nginx website feature enabled.
  • Confirm that PHP-FPM is selected and running for the PHP version assigned to the site.
  • Check the site’s PHP configuration rather than assuming /etc/php.ini controls it.
  • Test a minimal PHP file to distinguish an application error from an Nginx-to-FPM configuration problem.

One domain works while another does not

Compare the virtual-server features, document roots, PHP-FPM settings and DNS records for the two domains. Separate FPM pools mean that a problem can be isolated to one site; investigate that site’s pool and configuration before changing global PHP settings.

Mail or DNS disappeared after choosing mini

The mini profile intentionally skips local mail handling and local DNS, along with spam and virus filtering, FTP and Jailkit. Restore those functions through external services or rebuild with the full profile if the server is expected to provide them locally.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Operational checklist for a production LEMP server

  • Record the Virtualmin and operating-system versions before changes.
  • Keep the operating system and package sources on supported, patched releases.
  • Back up site data, databases and Virtualmin configuration before an Apache-to-Nginx migration.
  • Use PHP-FPM pools per site and review their resource usage as traffic grows.
  • Apply per-site PHP changes in the virtual server’s configuration; use version-specific additional .ini files for settings intended to propagate.
  • Test HTTP, HTTPS, static files, PHP execution and database-backed requests after every web-server change.
  • Keep DNS pointed at the correct server and lower TTLs ahead of a planned cutover when appropriate.
  • Document any disabled status, Awstats or htpasswd features so they are not re-enabled without an Nginx-compatible plan.

Decision summary

Install LEMP from the beginning when Nginx is your target: use a fresh supported operating system, meet the memory and DNS prerequisites, run the automated bundle installer, and select PHP-FPM for each PHP site. Reserve Apache-to-Nginx conversion for a controlled migration with backups and a feature inventory. The most important configuration boundary is per-site PHP-FPM, while the most common strategic mistake is treating the LAMP/LEMP choice as easy to undo.

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.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.