Virtual Hostings

Configure Virtual Hostings to use multiple domain names.

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

[1] Configure httpd for Virtual Hostings.

[root@futurelinux ~]# vi /etc/httpd/conf.d/vhost.conf

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

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

[root@futurelinux ~]# 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.

[future@futurelinux ~]$ echo "Virtual Host Test Page" > ~/public_html/virtual.php