Virtualmin is among the very few hosting control panels that support Nginx. Until now I configured my client’s servers without a control panel. It’s wasn’t much of an issue, but I received mixed comments about it time to time. Specially from people who are used to shared hosting. So I went searching for a control panel that supports Nginx.
The solution is Virtualmin. Although it doesn’t support Nginx out of the box, it can be enabled with little configuration and a plugin. In this post, I’m going to walk you through the steps of configuring an unmanaged VPS with Virtualmin and Nginx. This configuration will create the platform to host websites based on WordPress and alike. I’ve tested Prosper202 on this setup and found it working without errors.
Before we start, I’m going to assume that you have an unmanaged VPS with root access ready to go. If not, you can get one from best unmanaged VPS providers. Do not try this on a server that is already setup. This tutorial is only intended for fresh servers. And also, it’s important that your VPS operating system is Ubuntu 14.04 x64 bit. Otherwise Virtualmin installation will fail. If you want to save all the trouble going through this tutorial, you can hire me to do it for you.
[product_slider category=”installations” orderby=”date” order=”desc” latest=”1″ style=”traditional”]
So let’s start by removing some packages that might have already installed on the server with OS.
apt-get purge apache2* bind9* samba*
Your server’s hostname should be a fully qualified domain name (Such as example.com or sub.example.com) for Virtualmin to work. You can check your current hostname by running following command.
That should output your current hostname. If it’s something other than your domain or a sub-domain, you should fix it before going any further. you can do it by following ‘Change Ubuntu 14.04 Hostname from Command-line‘ tutorial.
Assuming you have a proper hostname setup for your server, let’s download Virtualmin install script,
Run the script you just downloaded with,
Installation process will take few minutes to complete. The script will install Apache2 as http server by default. Since we’re going to use Nginx, we should stop Apache2.
service apache2 stop
Now it’s safe to install Nginx,
apt-get install nginx
Following command will add two plugins to Virtualmin that enable Nginx support,
apt-get install webmin-virtualmin-nginx webmin-virtualmin-nginx-ssl
Installing PHP 5 modules
You’ll need some PHP 5 modules installed on your server to host php applications error free. So lets install the lot,
apt-get install memcached mcrypt php5-memcache php5-mysqlnd php5-xmlrpc php5-curl php5-gd php5-cli php-pear php5-dev php5-imap php5-mcrypt
And enable the php5-mcrypt module,
Virtualmin Post-Installation Wizard
You can access Virtualmin on following URL with your root password. Make sure you replace example.com with your domain name. Your DNS should be propagated for this to work.
After successful login, you’ll be taken to the Virtualmin Post-Installation Wizard. It is pretty self-explanatory, just remember to select MySQL as database server and Only store hashed passwords as password storing method. You’ll be good with default selections for all other steps.
Configuring Virtualmin to enable Nginx
Although Virtualmin is successfully installed and Apache2 web server has been stopped, Virtualmin is still configured use to Apache2. To change that please go to System Settings -> Features and Plugins from your Virtualmin dashboard and disable (un-check) following features.
- Apache website
- SSL website
- DAV Login
- Protected web directories
- AWstats reporting
- Subversion repositories
And enable following,
- Nginx website
- Nginx SSL website
Save the changes and switch to Webmin from top-left corner. Then go to System -> Bootup and Shutdown. Check apache2 and click Disable On Boot. Then check nginx and click Start On Boot. That’ll make sure Nginx is started with system reboots. Your Virtualmin should be ready to host websites with Nginx as the web server at this point. More on that later.