risley.netVirtual Hosting (NetPresenz Version)



What it Does

Virtual Hosting (often called "multihoming" or "IP Sharing") allows you to host several different domains from a single IP address. This saves IP address space, which is in somewhat short supply these days. It is also useful for the webmaster operating from a home DSL line or other service where only a single IP address is provided. You can usually purchase additional IP addresses from your ISP, but this script (being free) is more economical.

This script works by redirecting anyone looking for a missing page to a different URL based on the host name supplied with the request. How that helps you implement IP sharing may not be obvious at first, so let's use my site as an example:

What You Need

What You Do

Say you want to host two different website with two different domains from a single IP address: www.risley.net and www.guerillaphysician.com.

How it Works

NetPresenz has a powerful feature for handling missing files. When it cannot find a file requested by a browser, it looks for a file named "missing.xxxx" where the x's represent various extensions (.html, .acgi, and others). When it finds that file, it returns it instead of the requested file. In the case of missing.acgi, it is a script that executes instead of just returning the file contents.

The script looks at the hostname in the request and, using the table you create in the domTrans property, obtains a new URL. It then appends the path and file name from the original request to the new URL. If you put each domain in a separate folder on your site, it appears to the user that each domain is hosted on a separate machine (though if they look carefully at the URLs for individual pages, they'll see that all pages on a given site are in a subdirectory).

Other Information

If you don't use NetPresenz, I have a slightly less capable script that works with virtually all Mac OS WWW servers. See the PWS Virtual Hosting page for details.

I wrote an article in TidBITS on using the Macintosh as an inexpensive Internet server platform. The response to that article prompted my posting this page. It is called Serving the Internet from a PowerBook 5300, and is available online.

If you have comments, problems, or suggestions, please feel free to email me. I'll answer as soon as I can, but remember that I don't have gobs of time to provide technical support for free software.

Thanks for your interest and support!


risley.net

Date created: July 1, 2000
Last modified: September 4, 2000
Copyright © 2000 Ron Risley

risley.net webmaster