A quick guide that will show you how to host multiple websites on a single Digital Ocean droplet. This is really useful for starter websites that have little to no traffic. You can save a lot of money on hosting by running a virtual host $5 droplet with LAMP on Ubuntu 16.04. I use this setup to build and sell starter sites on Flippa.

First create a $5 droplet running LAMP on Ubuntu 16.04 and ssh into the droplet via terminal or putty. If you already have a Digital Ocean account, you have probably already done this before, if you haven´t just login to Digital Ocean and click “Create Droplet”, selecting “One Click Apps”, LAMP on 16.0.4, the first $5 droplet listed, choose any region and click the green “Create” button at the bottom.

Creating a LAMP on Ubuntu 16.04.4 Digital Ocean droplet.

Creating a LAMP on Ubuntu 16.04 Digital Ocean droplet.

If you haven´t got an account, use this link here to get $100 free credit https://m.do.co/c/c08a36ec894f 

So logged into the droplet via SSH we enter the following commands and repeat per domain / website you want to host on the droplet.

  1. sudo mkdir -p /var/www/YOURDOMAIN/public_html
  2. sudo chown -R $USER:$USER /var/www/YOURDOMAIN/public_html
  3. sudo chmod -R 755 /var/www/YOURDOMAIN/
  4. sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/YOURDOMAIN.conf
  5. sudo nano /etc/apache2/sites-available/YOURDOMAIN.conf
  6. Add the following 2 lines:
    ServerName YOURDOMAIN
    ServerAlias www.YOURDOMAIN

    Make sure it looks exactly as below, you need to change 2 lines and add the 2 lines above.

    Config File Multi-Site Droplet

  7. sudo a2ensite YOURDOMAIN.conf
  8. sudo systemctl restart apache2
  9. Done! Just make sure you have setup DNS records to point the domain name at the server.

The public directory of your website cab be found at /var/www/YOURDOMAIN/public_html/

I use WordPress for most of my sites, if you would like to learn how to install WordPress on your newly created virtual host droplet, I have written a quick a guide here.