VirtualHost on Apache
There are two basic kinds of virtual hosts: those that are based on having a unique IP address, and those which share IP addresses but have different names. The latter are much more common on the Web these days, but the former are still in heavy use in organisations with relatively few sites being hosted per Web server.
Vhosts which have their own IP addresses are called IP-Based virtual hosts, and those that share an address are called Name-Based virtual hosts.
Some clients are not compatible with name-based virtual hosting because they are ancient. For name-based virtual hosting to work, the client must send the HTTP Host header.
Name-based virtual hosting cannot be used with SSL secure servers because of the nature of the SSL protocol.
Some operating systems and network equipment implement bandwith management that cannot differentiate between hosts unless they are on separate IP addresses.
IP-based virtual hosts use the IP address of the connection to determine the correct virtual host to serve. Therefore, you need to have separate IP address for each host. With the name-based virtual hosting, the server relies on the client to report the hostname as part of the HTTP headers. Using this technique, many different hosts can share the same IP address.
Name-based virtual hosting is usually simplier, since you only need to configure your DNS server to map each hostname to the correct IP address and then configure Apache HTTP Server to recognize the different hostnames. This may sound great, but here are 3 problems with using name-based virtual hosting:
Example: You have multiple domains going to the same IP and also want to serve multiple ports. By defining the ports in the NameVirtualHost tag, you can allow this to work. You must match the to the NameVirtualHost name:port. If you do not, the configuration will not work.
Back to main page
Copyright © 2003-2016
All rights reserved