Overview
Nginx is a high-performance web server known for its speed and efficiency, particularly well-suited for sites with high static content or environments with limited memory. For more details on Nginx, visit the Nginx Wiki.
Using Nginx
Once Nginx support is configured, you can manage virtual servers similar to Apache:
- Virtual server creation: When creating a new virtual server, select Nginx website enabled under Enabled features, instead of Apache website enabled.
- CLI API: Use
--virtualmin-nginx
flag instead of--web
for non-SSL websites and--virtualmin-nginx-ssl
instead of--ssl
for SSL-enabled sites. - Remote API: Use the
virtualmin-nginx=
parameter instead ofweb=
.
Configuring Nginx support in Virtualmin
Clean installation as LEMP stack
- Automated installation: During Virtualmin installation, use the
--bundle LEMP
option with thevirtualmin-install.sh
script. This sets up a LEMP (Linux, Nginx, MariaDB, PHP) stack. For more information, see the LAMP vs. LEMP documentation.
Manual webserver switch
Warning!
Manual switching involves advanced configuration and is generally not advisable for average users due to its technical nature.
Manual switching involves advanced configuration and is generally not advisable for average users due to its technical nature.
Manual switch from Apache to Nginx
- Disable Apache: Disable Apache.
- Debian and derivatives
systemctl disable --now apache2
- RHEL and derivatives
systemctl disable --now httpd
- Debian and derivatives
- Disable Apache as Virtualmin feature
virtualmin set-global-feature --disable-feature web --disable-feature ssl
- Install Nginx and dependencies: Install Nginx and Nginx Virtualmin modules from your repository.
- Debian and derivatives
apt-get install nginx-full webmin-virtualmin-nginx webmin-virtualmin-nginx-ssl
- RHEL and derivatives
dnf install nginx wbm-virtualmin-nginx wbm-virtualmin-nginx-ssl
- Debian and derivatives
- Configure Virtualmin for Nginx
virtualmin-config-system -i Nginx
Switching from Nginx to Apache
- Disable Nginx: Disable Nginx.
- RHEL and Debian derivatives
systemctl disable --now nginx
- RHEL and Debian derivatives
- Disable Nginx as Virtualmin feature
virtualmin set-global-feature --disable-feature virtualmin-nginx --disable-feature virtualmin-nginx-ssl
- Install Apache: Install the Apache package along with necessary modules.
- Debian and derivatives
apt-get install apache2 libapache2-mod-fcgid apache2-suexec-custom
- RHEL and derivatives
dnf install httpd mod_fcgid mod_ssl mod_http2
- Debian and derivatives
- Configure Virtualmin for Apache
virtualmin-config-system -i Apache
- Enable Apache as Virtualmin feature
virtualmin set-global-feature --enable-feature web --enable-feature ssl