October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Configure Virtualmin with Nginx and PHP-FPM

Install Virtualmin's LEMP stack with Nginx and PHP-FPM, understand full versus mini deployments, and follow the documented steps for migrating an Apache-based server.
Length12 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a new server, install Virtualmin with its LEMP bundle rather than installing Apache first: sudo sh virtualmin-install.sh --bundle LEMP. This selects Linux, Nginx, MariaDB and PHP as one supported deployment. Use PHP-FPM for each PHP website, prepare a fresh supported operating system, point DNS at the server, and size memory for the services you actually intend to run.

If Virtualmin is already using Apache, switching to Nginx is a migration, not a single setting. Apache must be disabled, dependent Virtualmin features adjusted, Nginx modules installed, the system reconfigured, and Nginx features enabled globally and for each existing virtual server.

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 you need before installing Virtualmin

Virtualmin’s automated installer is designed for a new, clean server. Start with a supported operating system that has current security updates and root or equivalent administrative access. Do not build a LEMP installation on top of an existing, heavily modified web stack unless you are prepared to resolve package and service conflicts manually.

  • A fresh supported operating system: the installer configures the package manager and required dependencies. Existing web, mail or database packages can change the result of an automated installation.
  • Enough memory: Virtualmin states that a basic installation needs at least 1 GiB of RAM. A full installation with mail, spam filtering and virus scanning needs about 4 GiB or more.
  • DNS control: create records that point the domain and any required host name to the server before publishing websites. Incorrect DNS can make a correct Nginx configuration appear broken.
  • Administrative access: you need to run the installer and control services such as Apache, Nginx and PHP-FPM.
  • A deliberate LAMP/LEMP decision: Virtualmin’s current documentation says the bundle choice cannot be changed after installation without significant manual work.
Deployment target Memory guidance Services included Best fit
Basic installation At least 1 GiB RAM, according to Virtualmin’s 2026 installation guidance Core Virtualmin hosting stack Small web server with modest service requirements
Full installation About 4 GiB RAM or more, according to Virtualmin’s 2026 guidance Web, mail, spam filtering and virus scanning, plus the broader hosting stack A server intended to provide the complete hosting feature set
Mini installation Virtualmin does not state a separate minimum in the cited guidance Retains the web stack while skipping local mail handling, spam and virus filtering, local DNS, FTP and Jailkit Low-memory, web-only VPS deployments

Memory is not just an installation checkbox. Mail queues, spam scanning and virus scanning can consume substantially more memory than a web-only server, so choose the full profile only when those local services are required. If DNS, mail and FTP are supplied elsewhere, the mini profile avoids installing services you will not operate.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Install a new LEMP server with the automated installer

1. Prepare the host name and DNS

Assign the server a stable host name and configure the DNS records for each domain to resolve to its public address. Allow time for records to propagate before testing websites. A domain that still points to an old address will reach the old server regardless of how carefully Nginx is configured.

2. Log in to the clean server

Use a root shell or an account with permission to run commands through sudo. Apply the operating system’s current security updates, then confirm that no existing Apache or other web service is expected to own ports 80 and 443. The automated installer needs to manage the package and service layout itself.

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

3. Run the LEMP bundle

sudo sh virtualmin-install.sh --bundle LEMP

The LEMP option tells Virtualmin to install the Linux, Nginx, MariaDB and PHP combination. Virtualmin’s download and installation documentation recommends the automated route because it configures package dependencies and reduces manual configuration errors.

4. Select the lighter profile when appropriate

For a web-only host, the installer supports a mini profile:

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

The mini type is intended to omit local mail delivery, spam and virus filtering, local DNS, FTP and Jailkit while keeping the web hosting components. Do not use it when the server is expected to provide those services locally.

5. Let the installer finish as one transaction

Do not interrupt package installation or start adding alternate web servers while the script is running. The installer configures dependencies and services together. When it completes, sign in to Virtualmin/Webmin, create a test virtual server and verify that its DNS name resolves to this host before troubleshooting application code.

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

Choose PHP-FPM for Nginx-hosted websites

PHP-FPM is the recommended PHP execution mode for Virtualmin. Instead of loading PHP into an Apache process, Nginx passes PHP requests to a FastCGI Process Manager pool. Virtualmin explains that separate pools for each website improve isolation, security, stability and resource management in shared hosting. The model also fits Nginx, which does not use Apache’s mod_php execution path.

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

How the request path works

  1. A browser requests a URL from the domain.
  2. Nginx serves static files such as HTML, CSS, JavaScript and images directly.
  3. When the request targets a PHP script, Nginx forwards it to the PHP-FPM socket or endpoint assigned to that virtual server.
  4. The site’s PHP-FPM pool executes the script with that site’s permissions and returns the response to Nginx.
  5. Nginx sends the completed response to the browser.

Separate pools mean one site’s PHP workers can be limited or restarted without putting every site’s PHP execution in the same process group. They also make it easier to identify which virtual server is consuming CPU or memory.

Set the execution mode per virtual server

When creating a new virtual server, choose PHP-FPM in its PHP execution options rather than an Apache-specific mode. On an existing site, open that virtual server’s PHP configuration and select the PHP-FPM option provided by your Virtualmin version, then save and apply the change. Menu names can vary between Virtualmin releases, but the required result is the same: the site’s PHP requests must be sent to its FPM pool.

After changing the mode, test a real PHP page from the domain. A static page proves only that Nginx is listening; a PHP page proves that Nginx, the virtual-server mapping and PHP-FPM are connected. Remove diagnostic files after testing, especially any page that displays environment details.

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

Understand PHP configuration scope

PHP settings can exist at more than one level. Virtualmin specifically cautions that changing the system-wide /etc/php.ini does not automatically change every virtual server’s individual php.ini. A site can have its own limits and extensions even when the operating system has a different default.

  • System configuration: affects the PHP installation where the setting is read, but is not a guarantee that every virtual server inherits the value.
  • Per-version .ini files: Virtualmin notes that these can be used for settings intended to propagate across domains using that PHP version.
  • Per-site configuration: use the virtual server’s PHP options or its individual configuration when one domain needs a different memory limit, upload size or execution setting.

After changing a setting, test from the affected virtual server and confirm the effective value rather than assuming the edited file was loaded. Keep a record of which PHP version and configuration layer owns each important setting; this prevents a later package update or version change from appearing to “undo” a site-level change.

Full LEMP versus mini LEMP

The two profiles solve different hosting problems. Full installation is a broader, more convenient all-in-one host, but its mail, filtering and scanning services raise the memory requirement. Mini installation is narrower and better suited to a server whose only local responsibility is web hosting.

Question Full installation Mini installation
Websites with Nginx and PHP-FPM Included Included
Local mail handling Included Skipped
Spam and virus filtering Included Skipped
Local DNS service Included in the broader stack Skipped
FTP and Jailkit Included in the broader stack Skipped
Memory guidance About 4 GiB or more for the full feature set No separate minimum stated by Virtualmin in the cited guidance

Choose the profile based on service ownership, not on the number of domains alone. Ten small static sites may need fewer resources than one application with many PHP workers, while a mail-enabled server needs memory for filtering even if it hosts only one website.

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.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Do not treat an Apache-to-Nginx change as a toggle

Virtualmin’s documentation labels switching an existing Apache installation technically complex. The LAMP/LEMP choice is difficult to reverse because Apache-specific modules, virtual-server templates and dependent features may already be configured. Plan a maintenance window and take backups before changing a production host.

1. Disable Apache

Use the service name for the operating-system family:

# Debian derivatives
sudo systemctl disable --now apache2

# Enterprise Linux derivatives
sudo systemctl disable --now httpd

Stopping the service releases ports that Nginx must bind. Disabling it prevents Apache from returning after a reboot while the migration is in progress.

2. Disable Apache-dependent website and Virtualmin features

Existing virtual servers may have Apache website features enabled. Disable those features before enabling their Nginx equivalents. Virtualmin specifically calls out dependent functions such as status reporting, Awstats and htpasswd; review each site’s feature set rather than assuming that every Apache dependency has the same Nginx implementation.

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

3. Install Nginx and the Virtualmin Nginx modules

Virtualmin’s documented package examples differ by distribution:

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

Install the set that matches your distribution’s package manager and repository configuration. Do not mix package names between families merely because both systems are called “Linux.”

4. Rebuild the system configuration for Nginx

sudo virtualmin-config-system --include Nginx

This tells Virtualmin to configure the Nginx integration rather than leaving the system with only manually installed packages.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

5. Enable Nginx features globally

Enable the global virtualmin-nginx and virtualmin-nginx-ssl features in Virtualmin. These provide the Nginx website and TLS integration that Apache-based templates previously supplied.

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

6. Enable Nginx features for existing virtual servers

Global availability does not automatically convert every existing domain. Enable the Nginx website and Nginx SSL features for each virtual server that should be served by Nginx. Check each site’s document root, PHP-FPM selection, redirects and certificate settings before bringing it back into service.

7. Remove or quarantine obsolete Apache assumptions

Review rewrite rules, access-control files, authentication directives and monitoring integrations. A rule written for Apache may not be valid Nginx syntax, and a feature that depended on mod_status, Awstats integration or Apache password files may need a different configuration. Keep the old configuration backed up, but do not leave two services competing for the same ports.

Validate a new or migrated Nginx installation

Use a staged test sequence so that a failure identifies the layer that needs attention.

  1. Resolve DNS: query the domain from a network outside the server and confirm it returns the server’s current address.
  2. Check service ownership: confirm Apache is stopped on a migrated host and Nginx is the service listening for web traffic.
  3. Open a static file: verify that the expected virtual server and document root answer instead of a default Nginx page.
  4. Run a PHP request: load a small application page through the domain. A static success with a PHP failure points to the FPM mapping, socket, permissions or PHP configuration.
  5. Test HTTPS separately: confirm the SSL virtual-server feature and certificate serve the intended domain, not just the HTTP site.
  6. Test each existing domain: migrations can leave one virtual server on an old template even when another site works.
  7. Inspect logs and resource use: correlate Nginx errors, PHP-FPM errors and system memory rather than changing several settings at once.

Keep one simple test page and one representative application page available during the cutover. The first isolates the web server; the second exercises PHP-FPM, file permissions, database connectivity and application routing.

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

Common failure modes and fixes

Nginx will not start after migration

The usual first check is port ownership. Apache may still be running, or a second service may have claimed port 80 or 443. Stop and disable the conflicting service, then validate the Nginx configuration before starting it again. If the problem appeared after enabling a migrated virtual server, inspect that server’s generated configuration for an Apache-only directive or duplicate listener.

The domain shows the wrong site

Verify DNS first, then verify the domain is enabled as an Nginx virtual server and points to the intended document root. A stale DNS record, a default server block or an unchanged Apache template can all produce a valid response from the wrong site.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Static files work but PHP returns an error or downloads as text

This indicates that Nginx is serving the site but is not handing PHP requests to the correct FPM pool. Confirm that PHP-FPM is selected for the virtual server, that the pool exists for the installed PHP version and that the Nginx integration was rebuilt with virtualmin-config-system --include Nginx. Check permissions on the socket and script path before changing application code.

Changing /etc/php.ini has no visible effect

Virtualmin warns that a system-wide file does not necessarily override each virtual server’s individual php.ini. Inspect the site’s effective configuration and place a shared setting in the appropriate per-version .ini file or set it at the virtual-server level, depending on the scope you need.

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

One site consumes all available memory

PHP-FPM’s per-site pools provide the isolation needed to identify this condition. Review that site’s worker limits and application behavior, then reduce unnecessary concurrency or move to a host with more memory. Do not assume that adding more PHP workers improves performance when the server is already swapping.

Awstats, status or password protection stopped working

These are among the Apache-dependent features Virtualmin identifies as requiring attention during migration. Re-enable the supported Nginx equivalent where one exists, or redesign that function using an Nginx-compatible method. Treat each feature as a separate migration task instead of repeatedly restarting Nginx.

Resource and security practices for PHP-FPM

  • Keep pools separated: retain one pool per website where Virtualmin provides that arrangement, especially on shared hosting.
  • Use least privilege: ensure application files and the FPM process identity match the virtual server rather than running every site as a single administrator account.
  • Patch the operating system and PHP packages: a supported OS and current security updates are prerequisites, not optional post-install work.
  • Install only needed services: the mini profile is safer and easier to resource when local mail, DNS, FTP and filtering are intentionally provided elsewhere.
  • Monitor before tuning: observe memory, CPU, FPM worker activity and Nginx errors before changing pool limits.
  • Protect diagnostic output: remove PHP information pages and temporary migration files after validation.
  • Back up before structural changes: keep copies of virtual-server data, databases, certificates and the previous Apache configuration before a migration.

When to install fresh instead of migrating

A fresh LEMP installation is normally the safer choice when the server is new, the current Apache host has few sites, or you can provision a replacement VPS and move domains one at a time. It preserves the clean assumptions of the automated installer and avoids converting every Apache-dependent feature.

Migration is justified when rebuilding the host is impractical and you have a tested backup, a maintenance window and a complete inventory of Apache-specific behavior. Count every virtual server, PHP version, SSL certificate, rewrite rule, scheduled task and dependent feature before starting. If you cannot reproduce a site’s behavior on a staging host, do not treat the production conversion as a routine package change.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

A practical decision checklist

  • New server: use a fresh supported OS, confirm DNS, choose the LEMP bundle and run the automated installer.
  • Web-only, low-memory server: consider --type mini so mail, filtering, local DNS, FTP and Jailkit are not installed unnecessarily.
  • Full hosting server: budget about 4 GiB RAM or more for the documented full service set.
  • PHP websites: select PHP-FPM, use separate pools and verify the effective per-site configuration.
  • Existing Apache host: plan a staged migration; disable Apache and dependent features, install the correct Nginx modules, run the Virtualmin system configuration command, then enable Nginx features globally and per site.
  • Configuration changes: do not assume /etc/php.ini controls every virtual server.
  • Future changes: record whether each setting belongs to the OS, a PHP version, a pool or an individual virtual server.

The reliable pattern is simple for a new deployment: select LEMP at installation time, run PHP through PHP-FPM, and size the server for the services it will actually host. An Apache-to-Nginx conversion can work, but it should be managed as a feature-by-feature migration with backups and validation, not as a one-click switch.

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 quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.