Using virtual hosting

About virtual hosting

Virtual hosting enables a filer to respond to requests directed to more than one IP address through a single physical interface. This means that a filer with only one physical interface can host several IP addresses.

Virtual hosting enables, for example, an Internet provider to host several Web sites but have only one physical interface. An HTTP server can use the destination IP address of an incoming HTTP request to find the directory that contains the HTTP pages belonging to the virtual host.

To set up and enable virtual hosting

To enable virtual hosting, you

Directing HTTP requests

To direct HTTP requests, use the following format in the /etc/httpd.hostprefixes file:

prefix [host-name-or-address ... ]
Variable Description
prefix Specifies a subdirectory in the HTTP root directory, which is defined by the options httpd.rootdir command.
host-name-or-address Specifies an HTTP host name or an IP address. You can have more than one of each.

For example, the line

/customer www.customer.com 192.225.37.102

means that an HTTP request that comes for the interface with address 192.225.37.102, or with an HTTP 1.1 Host: header specifying www.customer.com, is directed to /customer, and the requestor cannot get a file outside the /customer directory.

If the HTTP server receives an HTTP request that is destined for one of its virtual host IP addresses, in this example 192.225.37.102, the destination IP address is used to select the virtual host root directory from the /etc/httpd.hostprefixes file.

Mapping virtual host addresses

To map virtual host addresses to the virtual host interface, use the ifconfig command, as follows:


Copyright © 1999, Network Appliance, Inc. All rights reserved.

Part No. 210-02334
File: http4.htm
Last updated: 02/24/99 12:16:45