Background
Setting up and using NGINX with Virtualmin is well supported and dead easy. Instructions are already provided here but in this article we will give you a really quick overview of what needs to be done.
Why would you want to do this?
The reason why it’s better to use NGINX is for performance. NGINX simply outperforms Apache. ‘Nough said.
Important Note
It’s recommended that you do the NGINX conversion BEFORE you start hosting sites. Although Vander Host have converted existing Apache servers to NGINX after sites were already hosted, this will lead to a lot of configuration file work. It’s possible, but could be a daunting high pressure task if you are hosting many live sites already.
Steps to do the Conversion
Below are the steps outlined if you’re using Ubuntu/Debian or CentOS. Follow the steps for your operating system first, and then do the combined steps.
The Ubuntu/Debian Route
/etc/init.d/apache2 stop ; update-rc.d apache2 remove
apt-get install nginx
/etc/init.d/nginx start
apt-get install webmin-virtualmin-nginx webmin-virtualmin-nginx-ssl
The CentOS Route
service httpd stop ; chkconfig httpd off
yum install nginx
/etc/init.d/nginx start
yum install wbm-virtualmin-nginx wbm-virtualmin-nginx-ssl
Combined Steps
Do these steps in Virtualmin for both Ubuntu/Debian and CentOS.
System Settings->Features and Plugins
- Uncheck the following 5 items:
"Apache website"
"SSL website"
"AWstats reporting"
"DAV Login"
"Protected web directories"
- Check the following two items:
"Nginx website"
"Nginx SSL website"
Click "Save"
when done.
Congratulations! NGINX has a reputation for being faster than Apache so hopefully you’re on course for faster serving.