Tag Archives: virtual host

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/(exmaple.co.uk).conf

2. edit virtual host conf file

sudo nano /etc/apache2/sites-available/(example.co.uk).conf

The config file should look like this in the end:

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

3. enable the virtual hosts

sudo a2ensite (example.co.uk).conf

You will get the message below:

Enabling site (example.co.uk).
To activate the new configuration, you need to run:
service apache2 reload

4. reload apache

sudo service apache2 restart

All done 😀

Share this: