Ubuntu 14.04
Sponsored Link

Virtual Hostings2014/04/30

It's the example to configure virtual hostings.
The example below is set on an environment which the domain name is [srv.world], virtual domain name is [virtual.host (root directory[/home/ubuntu/public_html])].
[1] Configure Apache2.
vi /etc/apache2/sites-available/virtual.host.conf
# create new for virtualhost

<VirtualHost *:80>
    ServerName www.virtual.host
    ServerAdmin webmaster@virtual.host
    DocumentRoot /home/ubuntu/public_html
    ErrorLog /var/log/apache2/virtual.host.error.log
    CustomLog /var/log/apache2/virtual.host.access.log combined
    LogLevel warn

a2ensite virtual.host

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

/etc/init.d/apache2 restart

 * Restarting web server apache2
[2] Create a test page and access to it from a client computer with a web browser. It's OK if following page is shown.
mkdir ~/public_html

vi ~/public_html/index.html
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Virtual Host Test Page
Matched Content