WebSTAR 4 Manual & Technical Reference

Manual Contents | Chapter Contents | Previous Page | Next Page

Virtual Hosts: Hosting Multiple Web Sites

WebSTAR allows your one server to host a number of different web sites through the use of Virtual Hosts . With Virtual Hosts, you can map multiple IP addresses, hosts (such as "special.domain.com"), domains (such as "www.example.com"), and languages, to different root folders within the WebSTAR folder. WebSTAR will respond to HTTP requests as though each site was on a separate machine.

Virtual Hosting only applies to the WebSTAR Web Server. The FTP and Proxy servers can only use the default host name and IP address.

There are several ways to implement virtual hosts within WebSTAR:

Third-party modules are not covered in this chapter.
 

http://www.starnine.com/extendingwebstar.html

WebSTAR virtual hosts have different root folders and folder hierarchies, default file names, errors and no access files, but they share Caching , Suffix Mapping , CGIs and Plug-Ins, Security Realms , and more.

Routing to Virtual Hosts

When a URL comes to the server, WebSTAR routes differently based on IP address, Domain Name and the browser Language field (if any).

To set up this routing using the WebSTAR Admin application, see Virtual Hosts .

For examples, see Editing Virtual Hosts Entries .

Configuring Virtual Hosts

To set up virtual hosts, you must decide whether to use IP Multihoming, Virtual Domains, or a third-party solution. Each method of implementing virtual hosting has its advantages and disadvantages, and you can experiment to find the best solution for your server.

Once you've decided which method is best, you'll also need to create your hosts, make your root folders and set up the routing correctly.

About Virtual Domains

Virtual domains require only one IP address--no need to ask your ISP or network administrator for additional addresses. All you need to do is arrange for DNS services and, if you are setting up a new domain, register your additional names with your area's registry.

The World-Wide Web Consortium strongly recommends that web servers use virtual hosts, so as not to consume additional IP addresses simply for Web hosting. See section 19.5.1 of the HTTP standard at:

http://www.w3c.org/Protocols/rfc2068/rfc2068

Disadvantages include:

About IP Multihoming

Advantages of this virtual hosting method include:

However, you'll need additional IP addresses, which are becoming scarce.

How To Set Up Virtual Hosts

1 Choose your virtual hosting method according to the information above.
2 If you want a new domain, you'll need to register it with the Network Solutions or another domain registry.
For information on registration, see Your Server's Host Name .
3 Work with your DNS provider to enter your new host names in the DNS routing system.
4 If you're using IP Multihoming, get an additional IP address and follow the instructions IP Multihoming: Special Configuration .
5 Create new folders for each host, as described in Virtual Host Root Folders and Default Files .
6 Put unique default/index files in each virtual host root folder, and if you choose, Error and No Access files.
If you're using Virtual Domains, see Virtual Host Default Files .
7 Use the WebSTAR Admin application to set up routing to each host and host defaults, as described in Routing to Virtual Hosts .
8 Test your routing to make sure that your hosts appear as you intend.

IP Multihoming: Special Configuration

IP Multihoming (which Apple refers to as "Single Link Multihoming"), was introduced in Mac OS 8.1.

When Open Transport activates TCP/IP, the primary address will be obtained from the TCP/IP Control Panel setting. Note that you must have "manual addressing" set in that panel. Open Transport then looks for the IP Secondary Addresses file in the Preferences folder to determine what other IP addresses the system is to support.

Versions of the Mac OS after 8.6 are likely to have different interfaces to multiple IP addresses. See the Open Transport documentation for instructions.

Enter IP Secondary Addresses

If you don't already have one, WebSTAR's Installer will automatically create an empty IP Secondary Addresses file in the Preferences folder. All you have to do is fill it in.

Each line of the IP Secondary Addresses file contains a secondary IP address to be used by the system, and an optional subnet mask, for the address. If there is no subnet mask entry, then a default subnet mask for the IP address class will be used.

To mark a secondary address, use the prefix "ip="; for subnet mask use "sm=", for the router address use "rt="; for spacing use the space bar; and for comments, use a semicolon (";") at the beginning of the line.

You can leave the Subnet Mask and router address blank on all entries, or fill them in for all entries. However, you must be consistent .

For example:

 

; IP address        Subnet Mask        router addresses
 
;-----------        -----------        ----------------
 
ip=192.168.0.3       sm=255.255.255.0     rt=192.168.0.9ip=192.168.0.4       sm=255.255.255.0     rt=192.168.0.9ip=192.168.0.5       sm=255.255.255.0     rt=192.168.0.9

Reset Open Transport

Open the TCP/IP Control Panel, and make sure the default IP address is entered correctly. Restart the machine, so that it can use the new Open Transport configuration. If the IP address was previously used for another machine or another virtual hosting method, you may have to reset your router as well.

Once you're done with IP setup, continue to follow the instructions in Configuring Virtual Hosts .

Testing Your Secondary Addresses

For testing, you can "ping" the new secondary IP address: if it is working correctly, your machine will answer. If you look up the host name, you can tell if the DNS entry is working, as well.

Once you have the system working, your secondary IP address will appear in the Virtual Hosts Routing table. To avoid common problems, make sure you have:

Virtual Host Root Folders and Default Files

Each virtual host will have its own virtual host root folder . All URLs sent to that host relate to the virtual host root rather than the main WebSTAR root folder. Each host can also have individual default files.

Most of the WebSTAR settings are universal, including Suffix Mapping, Access Controls, and Logging options. Plug-Ins and CGIs are available to all virtual hosts, and the settings apply across hosts.

Setting Up Root Folders

To set up virtual host root folders, simply create a new folder somewhere within the WebSTAR folder on the server. You must have access to your Mac to do this, either directly, or through WebSTAR FTP, AppleShare, ARA or Timbuktu. All files in the virtual host will be inside of this folder.

See also Links to Subfolders and Parent Folders .

For ease of navigation, you should create the virtual host root folder in the WebSTAR folder, or in a special folder within the WebSTAR folder.

Virtual Host Default Files

Each of the virtual host root folders can contain different Error and No Access files, which is particularly useful for providing feedback in multiple languages. Each virtual host can also be set to have different default index file names (for example, index.html as well as default.html ). The Virtual Hosts panel in the WebSTAR Admin application lets you specify these names in the Host Definition for Routing .

Special Virtual Domain Design Issues

When you use Virtual Domains (routing on host name rather than IP Address), the system relies on the browser sending the host name in the header. Older browsers (such as Netscape Navigator and Microsoft Internet Explorer versions 2 and older), do not send this information. Some web search index crawlers and spiders also do not send the header.

When a user with an older browser attempts to link to the virtual domain, the request will always go to the default host for that IP address. If you use Virtual Domains, design your default hosts' default pages so they be used to enter each Virtual Domain. You should also make sure that the default index file name, Error file, and No Access file settings will work in this case.

For internal links, be sure to use relative rather than absolute links in your HTML pages, using the double dot ( .. ) to move up a folder level, rather than always starting from the root. For example, use http://../weddings/favors rather than http://weddings/favors . As long as your links start from the current page rather than from the root folder, they will work properly (see Relative and Absolute Links ).

Although accessing a Virtual Domain through the default page is less convenient, it will still convey the HTML pages and other data correctly.

 


Manual Contents | Chapter Contents | Previous Page | Next Page