Virtual-Hosts

Virtual host refers to maintaining more than one server on a single machine; differentiated by their apparent host name. For example, both www.sambar.com and www.sambar.net reside at the same IP address, but appear as two independent web sites.

The Sambar Server supports virtual-hosts using the Host: directive passed by most newer Web browsers (and is a required feature of HTTP/1.1). This is the only mechanism used by the Sambar Server to support virtual hosting.

The benefits of using the Host: directive for virtual hosting is that it allows for a near-unlimited number of WWW servers to be supported by a single machine. A significant disadvantage is that the user's browser must support this part of the HTTP/1.1 protocol. Netscape Navigator 2.0 and later, as well as Microsoft's Internet Explorer 3.0 and later support this functionality.

Using non-IP Virtual Hosts

The configuration file vhosts.ini is used to configure virtual hosts for the Sambar Server. The following is a sample format for this file:

In addition, the default host directives are still found in the config.ini file. Should the host directive not match any of the hosts in the vhosts.ini file, or no vhosts.ini file exist (the default), the defaults from the config.ini file are used.

The Documents Directory directive may contain a path relative to the Sambar Server installation (shown) or an explicit path (i.e. c:/foobar/docs/ ).

Compatibility with Older Browsers

As mentioned above, many browsers do not send the required header for virtual hosts to work properly. One way to work around this is to have the default Sambar Server home page contain a map of all servers supported by the site and have all servers run within the same directory structure, allowing them to be cross-referenced even if the Host: directive is not sent.

Using the above example, the following would be the configuration of the config.ini file:

The vhosts.ini file would have the following configuration:

So when a browser that does not support virutal hosting comes to the site, the default.htm page is shown. This page has explicit links to SAMBAR.NET (home.htm) and SAMBAR.COM (index.htm). All documents for SAMBAR.NET are maintained in a directory structure within the docs directory as are the pages of SAMBAR.COM.

Implementation Limitations

There are some implementation limitations that users should be aware of: