Fedora 13
Sponsored Link

Virtual Hostings
2010/05/30
  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 for Virtual Hostings
[root@www ~]#
vi /etc/httpd/conf/httpd.conf


# line 975: uncomment

NameVirtualHost *:80

# add at the bottom for original domain

<VirtualHost *:80>
   DocumentRoot /var/www/html
   ServerName www.srv.world
   ErrorLog logs/srv.world-error_log
   CustomLog logs/srv.world-access_log common
   SuexecUserGroup fedora fedora
# enable suexec

</VirtualHost>


# add at the bottom for virtual domain

<VirtualHost *:80>
   DocumentRoot /home/fedora/public_html
   ServerName www.virtual.host
   ErrorLog logs/virtual.host-error_log
   CustomLog logs/virtual.host-access_log common
</VirtualHost>


[root@www ~]#
/etc/rc.d/init.d/httpd restart

Stopping httpd:
[  OK  ]

Starting httpd:
[  OK  ]

[2] Access to the test page that has original domain, it's OK if possible.
[root@www ~]#
chmod -R fedora. /var/www/html

[root@www ~]#
chmod 700 /var/www/html/index.cgi
[3] Access to the test page that has virtual domain, it's OK if possible.
[root@www ~]#
vi /home/fedora/public_html/index.cgi


#!/usr/local/bin/perl

print "Content-type: text/html\n\n";
print <<"EOM";
<html>
<body>
<div style="width:100%;font-size:40px;font-weight:bold;text-align:center">
Virtual Host Test Page</div>
</body>
</html>
EOM
exit;


[root@www ~]#
chown fedora. /home/fedora/public_html/index.cgi

[root@www ~]#
chmod 705 /home/fedora/public_html/index.cgi
Matched Content
 
Tweet