Apache : Name Based Virtual Hosts

The notable difference between IP-based and name-based virtual host configuration is the NameVirtualHost directive which specifies an IP address that should be used as a target for name-based virtual hosts.

For example, we use both http://www.abc.com and http://www.xyz.com at the IP address 192.168.0.1 We simply add to one of the Apache configuration files:

NameVirtualHost 192.168.0.1
192.168.0.1>
ServerName http://www.abc.com
DocumentRoot /www/abc

192.168.0.1>
ServerName http://www.xyz.com
DocumentRoot /www/xyz

Of course, to make this work, all that is needed is to make sure that the names http://www.abc.com and http://www.xyz.com are pointing to the IP address 192.168.0.1

More information can be found at www.apache.org

Leave a comment