Adding Virtual Hosts in Apache

1. Create a new folder for the new website:
     mkdir /var/www/www.ubuntutest.com

2. Create a new webpage:
     sudo nano /var/www/www.ubuntutest.com/index.html
     Add the following (or similar):
     <html><head><title>Ubuntutest.com Virtual Host</title></head><body>Welcome to Ubuntutest.com – Virtual Host</body></html>

3. Edit /etc/apache2/sites-available/000-default.conf (this is a file that already has stuff in it) and add the following block of text:
     <VirtualHost *:80>
    ServerName www.ubuntutest.com
    ServerAlias ubuntutest.com
    DocumentRoot /var/www/www.ubuntutest.com
   </VirtualHost>

4. Restart apache2:
     sudo service apache2 restart
     or
     sudo /etc/init.d/apache2 restart

5. Modify the hosts files on both Windows client and Linux Server Edit Windows hosts file:
     - Open Notepad in “Run as administrator” mode
     - File > open > c:\windows\system32\drivers\etc\
     - Add the line: <Ubuntu's ip address> www.ubuntutest.com
     Edit Ubuntu hosts file:
      sudo nano /etc/hosts
     - Add the line: 127.0.0.1 www.ubuntutest.com

6. Test in browser.

References

Name-based Virtual Host Support
https://httpd.apache.org/docs/2.4/vhosts/name-based.html

VirtualHost Examples
http://httpd.apache.org/docs/2.4/vhosts/examples.html