|
A single http daemon can also be used to service to the main server and all its virtual hosts. Name Based Virtual Hosts Using the new name based virtual hosts is quite easy, and superficially looks like the old method. The notable difference between IP-based and Name-based virtual host configuration is the NameVirtualHost directive. This directive specifies a single IP address that should be used as a target for name-based virtual hosts. For example, suppose that both www.sharanam.com and www.ivan.com point to the IP address 172.16.9.66. Then simply add the following to the Apache's httpd.conf:
ServerName 172.16.9.66
NameVirtualHost 172.16.9.66 <VirtualHost 172.16.9.66> DocumentRoot c:\Sharanam ServerName www.sharanam.com </VirtualHost> <VirtualHost 172.16.9.66> DocumentRoot c:\ivan ServerName www.ivan.com </VirtualHost> The Following entries should be appended to the hosts file available under C:\WINDOWS\system32\drivers\etc directory: 172.16.9.66 www.sharanam.com 172.16.9.66 www.ivan.com After making any changes to the httpd.conf ensure that Apache is restarted to apply the new changes. Click here to download the complete E-Book.
|