Virtual Hostings2014/12/30 |
Configure Virtual Hostings to use maltiple domain names.
The example below is set on an environment which the domain name is [srv.world],
virtual domain name is [virtual.host (root directory[/home/fedora/public_html])].
It's necessarry to set Userdir settings for this example, too.
|
|
[1] | Configure httpd. |
[root@www ~]#
vi /etc/httpd/conf.d/vhost.conf # create new # for original domain <VirtualHost *:80> DocumentRoot /var/www/html ServerName www.srv.world </VirtualHost> # for virtual domain <VirtualHost *:80> DocumentRoot /home/fedora/public_html ServerName www.virtual.host ServerAdmin webmaster@virtual.host ErrorLog logs/virtual.host-error_log CustomLog logs/virtual.host-access_log combined </VirtualHost> 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. |
[fedora@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 </div> </body> </html> |
Sponsored Link |