Apache Virtual Hosts in Ubuntu

In this tutorial, I’ll show you the steps to configure 3 Apache virutal hosts running on a single EC2 Ubuntu Instance. The three domains, that I’ll use in this tutorial are:

1) linuxsoft.tk
2) rbgeek.tk
3) tendo.tk

DNS setting for these 3 domains are as follows:

Create three folders inside the /var/www folder, they will host these new sites:

sudo mkdir /var/www/tendo
sudo mkdir /var/www/rbgeek
sudo mkdir /var/www/linuxsoft

Copy the /etc/apache2/sites-available/default file with the name same as the new sites:

cd /etc/apache2/sites-available/
sudo cp default tendo
sudo cp default rbgeek
sudo cp default linuxsoft

Edit the new config files for each site:

sudo nano linuxsoft

Add the line ServerName with the name of your domain/site and change both DocumentRoot and Directory that point to your new site:

Repeat these steps for other new sites same as above:



To enable the each virtual host, simply type:

sudo a2ensite tendo
sudo a2ensite rbgeek
sudo a2ensite linuxsoft
sudo a2dissite default

Finally, restart the Apache service:

sudo service apache2 restart

Test all the sites:





Hope this will help you!

Please Remember me in your prayers!

Enjoy :-)

2 responses to “Apache Virtual Hosts in Ubuntu

  1. Pingback: ec2 wordpress virtualhost | Lost Ferry

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: