I have multiple Websites and recently started using Digital Ocean to host multiple Websites. I have created Ubuntu 18.04 / 20.04 64 bit droplet to use following software.
Update on 5 Feb, 2021: This tutorial works for Ubuntu 18.04 and Ubuntu 20.04.
- Web Server (Apache or Nginx)
- Database Server (MySQL)
- Email (Dovecot, Postfix)
- Webmail Client (RoundCube)
- SSL Certificate (Let’s Encrypt)
1 CPU, 1GB RAM droplet is good enough for hosting 4 WordPress sites but once I added 1 more domain and existing Website traffic grew, I created 3 droplets. Two droplets are used as web servers. One droplet is used as a mail server as well hosting ancillary applications.
Even though Digital Ocean has multiple tutorials for installing Webmin, Apache, MySQL, Dovecot, PostFix, don’t use those tutorials. Those tutorials are meant for those who are running only individual components and requires higher level of knowledge of each component.
If you are an individual and want to get rid of shared hosting, this tutorial is for you.
When you are moving away from shared hosting, burden of maintaining Web server, database server, email server, SSL certificate etc on you.
Even though Digital Ocean does not recommend running Email server on the same server which hosts database and website, you may want to host it on the same server because your traffic is moderate enough. Once traffic grows, you may have a dedicated droplet as mail server. Digital Ocean does not care about their IP address reputation and hence they don’t monitor IP address abuse. Even if they are aware of abuse, they will let it continue. Due to their laxity, sometime you may face an issue where emails from your mail server will be rejected by Gmail and other email providers. If your mail server IP address has a good reputation, you can submit a request to remove your IP address from blacklist range.
Let’s start the setup.
Initial Server Setup
Follow this tutorial to setup your Ubuntu 18.04 server or tutorial to setup your Ubuntu 20.04 server for initial setup. Only follow step
- 1 – Logging in as Root
- 2 – Creating a New User
- 3 – Granting Administrative Privileges
- 4, 5 – STOP. Do not follow these steps. These steps are not needed. Webmin installs and setup firewall. Following the step 4 would cause problem with Webmin installation.
During the installation, it checked for upgrade. It had found grub/menu.lst file change. I clicked on checking the diffs between two version but did not find any non-space changes so I kept using the local version.
Install and Setup Webmin
Before you start the setup, follow the best practice that I came up with in order to host multiple Website.
Follow this tutorial to setup Webmin/Virtualmin. Even though this tutorial is for Ubuntu 16.04, it works for Ubuntu 18.04 and Ubuntu 20.04.
Ignore the step to modify “50-cloud-init.cfg” because as per my best practice, we are NOT installing DNS and hence this change is not needed.
Installing Virtualmin asked to install LAMP and also warned me of memory issue. I went ahead with “y” and allowed it to create “swap”. By default, it created swap for 270 MB.
During the installation, log showed following items are installed
- Webmin
- Usermin
- Fail2ban
- Removed nginx
- Postfix
- Lamp stack
It configured
- Awstats
- Apache
- Bind
- ClamAV
- Dovecot
- Firewalld
- Mysql
- NTP
- Net
- ProFTPd
- Procmail
- Quotas
- SASL
- Shells
- SpamAssasin
- Status
- Upgrade
- Usermin
- Webalizer
- Webmin
- Fail2banfirewalld
- Postfix
- Virtualmin
Once everything is up and running, now it is a time to disable/remove unwanted software/service and install other components.
Install Lets Encrypt Package
Update on 5 Feb, 2021: Lets Encrypt is already installed in the newer version of Virtualmin.
I went to “Webmin” > “Webmin Configuration” > “SSL Encryption” and clicked on “Install Now” button. It checks for the dependent packages and then enables “Install Now” and it install the Lets Encrypt.
Remove BIND, ProFTPD, DAV Login
Go to VirtualMin > System Settings > Features and Plugins > Removed following features
- BIND DNS domain
- ProFTPD
- DAV Login
Change Server Time
Go to Webmin > Hardware > System Time and change timezone
Increase Swap Size
1GB RAM is not good enough to run 4 WordPress Websites along with email. In order to get optimal performance, you need Swap. Webmin creates a swap of 270 MB so increase swap size to 2 GB.
Issues Encountered
I faced some networking issue. I don’t remember the exact error but here is a fix.
Go to Virtualmin -> System Settings -> Virtualmin Configuration -> Network Settings and set “Network interface for virtual addresses” Detect automatically. Also Default IP address for DNS records > change it to “Same as virtual server IP”. Once you save it, it will ask to reverify the configuration. Click on the button to reverify configuration.
Leave a Reply