Using Virtual Servers in OmniHTTPd

OmniHTTPd supports the use of both IP and non-IP virtual servers. HTTP/1.1 non-IP virtual server support is one of the big features of OmniHTTPd as many web server vendors do not fully support them yet. Most browsers that are available do support requesting data from non-IP virtual servers. Before going into the actual details of using these features, a backgrounder on virtual servers is in order.

What is a virtual server?

In OmniHTTPd, a virtual server is a server that processes the actual requests. For example, when OmniHTTPd receives a request, it tries to determine which virtual server it is for and then routes it accordingly. Notice that users who do not need virtual servers actually have a default virtual server that processes all of the requests. Some may argue that virtual servers don't become virtual until you have two of them. For setting up OmniHTTPd, however, it is best to think of the server configuration as containing one or more virtual servers with one being the default.

Why virtual servers?

Virtual servers can conserve both computer and IP resources by serving content for multiple sites from one web server on one computer. For example, suppose you need to run two sites, www.mysite.com and www.yoursite.com (both running on port 80). Without virtual servers, you would have to set up two computers and run a web server on both of them. With OmniHTTPd, you can do this on a single computer!

Stuff beyond the scope of this documentation

Before I go on, I should mention that there are certain issues with virtual servers that will go far beyond the scope of this documentation because they involve tinkering with your DNS server or ISP. In many cases, it may involve both. (Note that most ISP don't like to be tinkered with so you may be out of luck unless you run your own DNS server -- again way beyond our scope here) The issue is assigning multiple IP addresses (10.0.0.1) and names (www.mysite.com) to machines. In many cases you can't assign more than one IP to a machine under Win95 unless you have multiple adapters. For WinNT, you can assign as many IP addresses as you like. Names (i.e. www.mysite.com) are a different matter and are handled by the DNS server.

Note: Setting up virtual servers if you have a dynamic IP can be done but it requires a lot of fancy footworking. We do not provide email support for this type of stuff.

Legacy (IP) Virtual Servers

The most popular method of setting up extra virtual servers is to have two IP addresses point to the same machine. For example, say www.mysite.com = 10.0.0.1 and www.yoursite.com = 10.0.0.2. We want both 10.0.0.1 and 10.0.0.2 to point to the same machine. One way of doing this is to go into your Windows NT networking and add more IP addresses to your TCP/IP configuration.

Once you are done with that, go into OmniHTTPd and add a new virtual server (which will clone the old one). Set the first (default) virtual server to Server IP: 10.0.0.1 and Server Name: www.mysite.com and set the second virtual server settings to Server IP: 10.0.0.2 and Server Name: www.yoursite.com. You can now assign different document roots to each virtual server. For example, 10.0.0.1 can point to C:\HTTPD\HTDOCS while 10.0.0.2 can point to D:\WEB. Each virtual server can have its own alias lists, CGI lists and error templates along with entire realm and security definitions. To the user, it will appear as an entirely different server.

HTTP/1.1 (non-IP) Virtual Servers

One of the problems with legacy (IP) virtual servers is that they are very wasteful in terms of IP addresses. Every site required a separate IP addresses and people like your ISP don't like giving out blocks and blocks of IP addresses for free. This is where non-IP virtual servers step in. They allow you to have both www.mysite.com and www.yoursite.com = 10.0.0.1. In fact, you can have an unlimited number of names point to the same IP address and still have OmniHTTPd figure it out. Trust me, it can be done. Even I was skeptical before I programmed it in.

In our example, the setup is almost the same except that you don't need to add additional IP addresses to your network configuration, meaning that you can get this to work under Win95. For the default virtual server, set Server IP: 10.0.0.1 and Server Name: www.mysite.com. For the second virtual server set Server IP: 10.0.0.1 and Server Name: www.yoursite.com. Now the part that is beyond the scope of the documentation is that you have to set up the DNS server to resolve www.mysite.com and www.yoursite.com to the same IP.


Copyright © 1997, 1998 Omnicron Technologies Corporation