Creating a Virtual Host on Apache2 Ubuntu 14.04LTS

You will need to have installed/Created:

Sudo or root access
Folder Path Directory

1. create a virtual host for the website, by copying and renaming the default configuration file in apache

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/(

2. edit virtual host conf file

sudo nano /etc/apache2/sites-available/(

The config file should look like this in the end:

ServerAdmin [email protected]
DocumentRoot /var/www/(
ServerName (
ServerAlias (
<Directory /var/www/(>
AllowOverride All
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

3. enable the virtual hosts

sudo a2ensite (

You will get the message below:

Enabling site (
To activate the new configuration, you need to run:
service apache2 reload

4. reload apache

sudo service apache2 restart

All done 😀

The following two tabs change content below.

Keeran Marquis

Network Engineer
Keeran Marquis is a Network Engineer. His main goal is to learn everything within the Networking field, pick up a little bit of scripting, be a poor man sysadmin and share whatever he knows! All Posts are his own views, opinions and experiences, no guarantees they will work for you but point you in the right direction 🙂
Share this:

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.