Debian 8 Jessie
Sponsored Link

Virtual Hostings2015/05/11

 
It's the example to configure virtual hostings.
Following example is for domain name [srv.world], virtual domain name [virtual.host (root directory[/home/jessie/public_html])]. This example requires to configure Enabling Userdir, too.
[1] Configure Virtual Hostings.
root@www:~#
vi /etc/apache2/sites-available/virtual.host.conf
# create a file for virtual.host

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

root@www:~#
a2ensite virtual.host

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

root@www:~#
systemctl restart apache2

[2] Create a test page and access to it with web browser. It's OK if following page is shown.
jessie@www:~$
vi public_html/virtual.php
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align:center;">
Virtual Host Test Page<br />
</div>
</body>
</html>
Matched Content