Virtual Hostings

Configure Virtual Hostings to use multiple domain names.

   The example below is set on an environment that the domain name is [futurelinux.org], virtual domain name is [virtual.host (root directory [/home/future/public_html])]. It's necessarry to set Userdir settings for this example, too.

[1] Configure httpd for Virtual Hostings.

[[email protected] ~]# vi /etc/httpd/conf.d/vhost.conf

# create new
# for original domain
<VirtualHost *:80>
    DocumentRoot /var/www/html
    ServerName futurelinux.org
</VirtualHost>

# for virtual domain
<VirtualHost *:80>
    DocumentRoot /home/future/public_html
    ServerName virtual.host
    ServerAdmin [email protected]
    ErrorLog logs/virtual.host-error_log
    CustomLog logs/virtual.host-access_log combined
</VirtualHost>

[[email protected] ~]# systemctl restart httpd

[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.

[[email protected] ~]$ echo "Virtual Host Test Page" > ~/public_html/virtual.php