www.serve.com
which provides Web space for several
organisations including, say, smallco and baygroup.
Ordinarily, these groups would be given parts of the Web tree on www.serve.com.
So smallco's home page would have the URL
http://www.serve.com/smallco/and baygroup's home page would have the URL
http://www.serve.com/baygroup/
For aesthetic reasons, however, both organisations would rather their home pages appeared under their own names rather than that of the service provider's; but they do not want to set up their own internet links and servers.
Virtual hosts are the solution to this problem. smallco and baygroup would
have their own internet name registrations, www.smallco.com
and
www.baygroup.org
respectively. These hostnames would both
correspond to the service provider's machine (www.serve.com). Thus
smallco's home page would now have the URL
http://www.smallco.com/and baygroup's home page would would have the URL
http://www.baygroup.org/
Use multiple daemons when:
BindAddress www.smallco.com
This hostname can also be given as an IP address.
ServerAdmin, ServerName, DocumentRoot, ErrorLog
and TransferLog
configuration options to different values for
each virtaul host.
e.g.
<VirtualHost www.smallco.com>
ServerAdmin webmaster@mail.smallco.com
DocumentRoot /groups/smallco/www
ServerName www.smallco.com
ErrorLog /groups/smallco/logs/error_log
TransferLog /groups/smallco/logs/access_log
</VirtualHost>
<VirtualHost www.baygroup.org>
ServerAdmin webmaster@mail.baygroup.org
DocumentRoot /groups/baygroup/www
ServerName www.baygroup.org
ErrorLog /groups/baygroup/logs/error_log
TransferLog /groups/baygroup/logs/access_log
</VirtualHost>
This VirtualHost hostnames can also be given as IP addresses.