Last Updated on 5 months by Sachin G
Apache web server is installed by default with the Virtualmin module in Webmin, Now here I am going to install and Configure Nginx as a default web server in Virtualmin. Here I have followed these steps on CentOs Stream and Alma Linux Operating system. You can check the reference link to Install Virtualmin on Webmin CentOs, Red Hat, and Fedora. After that virtualmin will be installed. These steps should follow on Red Hat or the alternative distribution listed below.
- RHEL 8 and 9
- Alma and Rocky Linux 8 and 9
- CentOS and RHEL 7
- Debian 10, 11, and 12 on i386 and amd64
- Ubuntu 20.04 LTS and 22.04 LTS
Webmin should be installed before executing this virtualmin script.
Step 1: Download the Virtualmin script
So first we will download the Virtualmin script. Follow the below commands :
# wget https://software.virtualmin.com/gpl/scripts/virtualmin-install.sh
Step 2: Run Virtualmin script with –bundle LEMP
This script with the –bundle LEMP option will perform nginx installation instead of default Apache. and it executes with this option.
# sh virtualmin-install.sh --bundle LEMP
Step 3: Create Virtual Servers or website
Now, you can start creating websites in Virtualmin that will be served by Nginx.
Switch from Already Exist Apache to Nginx
Here I am explaining if you already running an Apache web server by default then you can how to switch from Apache to Nginx webserver in Virtualmin.
(1) Stop the Apache and disable it on boot
stop and disable the web server Apache service through the below command according to its distribution.
For Debian and it's derivatives
# systemctl disable --now apache2
For RHEL and it's derivatives
systemctl disable --now httpd
(2) Disable Apache web server feature
# virtualmin set-global-feature --disable-feature web --disable-feature ssl
(3) Install Nginx & it’s dependency
Once the Apache feature is disabled from Virtualmin. Execute the following commands to install Nginx on your server:
For Debian and it's derivatives
# apt-get install nginx-full webmin-virtualmin-nginx-ssl webmin-virtualmin-nginx
For RHEL and it's derivatives
# dnf install nginx wbm-virtualmin-nginx-ssl wbm-virtualmin-nginx
(4) Configure Virtualmin for Nginx
This will configure nginx on the panel.
# virtualmin-config-system -i Nginx
Although it doesn’t handle PHP processing by default, you should install PHP-FPM to enable PHP support. Once installed, you may need to configure PHP-FPM to work with Nginx.
After configuring Virtualmin . it’s essential to test your setup to ensure everything is working correctly. Open a web browser and navigate to one of your website domains.
By following the above steps, you’ve successfully installed and configured Virtualmin with a LEMP setup.
I am a professional freelance contributor and the founder of Tech Transit. I hold certifications in Linux, Ansible, and OpenShift from Red Hat, as well as CPanel and ITIL certifications. With a passion for education, culture, and community, I love writing and sharing knowledge. Since 2009, I’ve been actively using, setting up, supporting, and maintaining Linux systems. Linux truly rocks!