Virtual Hostings2013/01/24 |
It's the example to configure virtual hostings. Following example is done as
domain name[srv.world (root directory[/var/www/html])],
virtual domain name[virtual.host (root directory[/home/fedora/public_html])].
Before doing it, it's necessarry to add new doman name in your DNS first.
|
|
[1] | Configure httpd for Virtual Hostings. |
[root@www ~]#
vi /etc/httpd/conf.d/vhost.conf # create new # settings for original domain <VirtualHost *:80> DocumentRoot /var/www/html ServerName www.srv.world </VirtualHost> # settings 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.service |
[2] | Access to the test page that is for original domain, it's OK if possible. |
[3] | Access to the test page that is for virtual domain, it's OK if possible. |
[fedora@www ~]$
vi ./public_html/virtual.cgi #!/usr/local/bin/perl print "Content-type: text/html\n\n"; print "<html>\n<body>\n"; print "<div style=\"width: 100%; font-size: 40px; font-weight: bold; text-align: center;\">\n"; print "Virtual Host Test Page"; print "\n</div>\n"; print "</body>\n</html>\n"; chmod 705 ./public_html/virtual.cgi
|
Sponsored Link |
|