Virtual hosting allows you to serve several web sites, with different host names and even IP addresses, using the same WebSTAR server. Visitors to these sites will be routed by IP address, host name, and/or the browser Language setting to the correct Virtual Host, with its own default pages and web links.
See also: Identifying Your Site: IP, Host Name and DNS and Virtual Hosts: Hosting Multiple Web Sites .
Note that all hosts within WebSTAR share all other settings, including File Names, Caching, Suffix Mapping, CGIs and Plug-Ins, Security Realms, and Web Users and Passwords.
Before setting up your Virtual Hosts, you should do the following:
See also Security Realms .
To create and edit Virtual Hosts Entries, you will need to specify the IP address, host name, or language, using the Virtual Hosts table in the WebSTAR Admin Settings Window. When WebSTAR receives an HTTP request, it will consult this table to figure out which host should get the request. Each host can have a separate root folder and folder hierarchy, as well as default index file name and so on.
You must edit the Virtual Hosts using the WebSTAR Admin application: there is no Browser Admin page.
To make entries, just click the New button and fill in the fields. You should follow the instructions below to arrange your Virtual Hosts routing entries in the correct order, and see Working With Admin Lists for notes on creating, editing, moving, and deleting entries.
The first three columns in the routing table entry are IP address, host name, and language. Following the routing information is the virtual host root folder : the base folder for all HTML files for that host.
If the request matches all items with data in them for an entry, then the request is routed to that host. Be sure you follow the instructions below, or you may be surprised at the results.
For example, if the Host Name matches the request but the IP Address does not match, the entry is not matched.
If a request doesn't match any entries in the table, it will use the default host : the IP address and host name of the machine, the WebSTAR root folder, and the default names and files as defined in File Names and Paths .
The Host Definition fields allow you to specify the routing information, and the associated root folder, according to the instructions below.
Remember, the host name must be registered and the DNS entry enabled before the server will get requests for this host name.
Hosting web sites on several IP addresses requires configuration using Open Transport 1.3 or later (described in IP Multihoming: Special Configuration ). The IP Address popup menu reads the IP Secondary Addresses file in the Preferences folder of the current system disk, and allows you to specify the IP address for this host. If you have not set this up, you can't route by IP address, and the popup menu will only have the entries "Any" and your main IP address.
See also Routing to Virtual Hosts .
In simple cases, you can make a single entry for each IP address, and WebSTAR will route correctly. Just enter the IP address: do not include the host name. The browsers already know the host name, because they looked it up in the DNS entry for that IP address.
You can have several Virtual Domains for each IP address, see Combining IP Address, Host Name and Language Routing for instructions.
If you are using Virtual Domains, you're relying on the browser to send the host name in the header. In that case, the server will check the Host Name item in each entry until it finds a match. The entire host name must match, although the capitalization does not have to be the same. You do not need to include an IP Address for this routing. If you leave the Host Name field blank, it will be considered an "any" entry.
Do not enter an IP address , just the host name. The browsers have already looked up the IP address.
See also: About Virtual Domains .
If none of the entries matches the host name in the URL, or there is no header information, the web server will route the request to the default host. However, it's best to add an explicit default entry, so you keep track of these requests.
You can route to different Virtual Hosts according to the language in the browser request header. This is set in the browser preferences by the user. Use the Language popup menu to select any of the standard browser languages. You can choose an overall language, such as Spanish, or a specific regional version, such as Mexican Spanish.
IP addresses and Host Names are not required for Language Routing.
If none of the entries matches the Language code in the URL, the web server will automatically route the request to the default host. Therefore, you should make an explicit entry, to remind yourself what will happen
You can combine IP addresses, host names and/or language requirements in a single entry, for sophisticated routing to your Virtual Hosts. Remember that each URL header must match the entry exactly . The first exact match is the entry that will be used for routing that request. You should put the most specific entries first, and make sure you cover contingencies by putting general entries at the bottom. To move an entry to a better position, just select and drag the row.
Always test your Virtual Host Routing with a single element in each line before combining elements .
In the following example, there are five different web sites, using the following elements:
In this example, we are hosting a site registered in France (.fr).
widgets for widget information in English
mecanisme for widget information in French, using the widgets.domain.fr host.
cositas for widget information in Spanish, using the widgets.domain.com host.
knickknacks ( knickknacks.domain.com , on 192.168.0.3)
tchotchkeys ( www.tchotchkeys.com on 192.168.0.3)
The routing table looks like this:
Remember, the hosts are evaluated from top to bottom, so make sure that the host names are above the IP address entries.
The WebSTAR Web server monitor window will display the routing information at startup and every time you make a change to those settings. The display looks like this, with asterisks (*) replacing the word "Any":
WebSTAR Virtual Hosts
===============================
* knickknacks.domain.com * -> :kkn:
* www.tchotchkeys.com * -> :tch:
* widgets.domain.fr * -> :mecanisme:
192.168.0.2 * fr -> :mecanisme:
192.168.0.2 * es -> :cositas:
* widgets.domain.com * -> :widgets:
* www.domain.com * -> :widgets:
192.168.0.2 * * -> :widgets:
192.168.0.3 * * -> :kkn:![]()
Virtual Host Root Folder field specifies the folder designated as root for that host. The virtual hosts will work within this folder and its subfolders. This folder must be within the WebSTAR folder, for security. If the folder doesn't exist yet, you can create it on the server disk using the FTP server, if you have the correct permissions.
See also File Hierarchy and Virtual Hosting .
You can use the Choose button next to the Root Folder field in the Virtual Hosts panel. This will allow you to select the folder on your server disk. Or you can type the file path yourself.
For example, if your Virtual Host is using the knickknacks folder as its root folder, and it's in the WebSTAR folder, you could use either of these paths:
Web-HD:WebSTAR 3:kkn:
:kkn:
The first is an absolute file path from the hard drive, the second is a relative file path from the WebSTAR root folder, but either of them will indicate the correct location of the Virtual Host root folder.
See also File Names and Paths .
To correctly identify the Virtual Host, enter its name in the Server field. This is the name that will be used when the host builds full URLs for redirection and Plug-In use. It defines how the host will refer to itself. This is particularly important for IP address entries, language routing, and alternate host names, such as converting domain.com to www.domain.com .
Host names, even for Virtual Hosts, are also defined by the DNS entries for your IP addresses: see DNS for details.
For a given Virtual Host, you can override the default Index file names. If you leave this field blank, this Virtual Host will use all the Index file names you specified in the File Names and Paths panel field Index File Name .
You can also specify different Error and No Access files for this Virtual Host. This allows you to give host-specific or language-specific error messages. For information on these settings, see File Names and Paths .
The WebSTAR Virtual Hosts Settings file, in the Plug-Ins folder, stores the list of Virtual Hosts and their attributes. It is created after you enter the first Virtual Host using the WebSTAR Admin and save the information to the server. The WebSTAR Virtual Hosts Plug-In reads this file when the server starts up: when you see the list in the Virtual Hosts panel in WebSTAR Admin, it comes from this file.
Back up this file so you do not have to re-enter the Virtual Hosts settings if something happens to your disk or server machine.
The file has the eight fields, corresponding to the fields in the WebSTAR Admin panel, with tabs between them. To specify that a field should be "Any", leave it blank, so there are two tabs together.
The first three are the routing information (see Special Routing Considerations ). After that, the root folder path (see Virtual Host Root Folders ), and options, as described in Virtual Host Options .
The last character in the file should be a CR (Carriage Return) at the end of the last entry.
In this example Tab characters are replaced with dashes:
The file itself is a text file, and you can edit it if you are careful. Be sure to back up the Virtual Hosts file before editing it.
If you change this file, the WebSTAR Virtual Hosts Plug-In will read the new data when the server starts up. If the data is not entered in the correct format, it may ignore your virtual host settings. Always check the server status window on startup and use the Admin to verify your Virtual Host settings.
The WebSTAR Virtual Hosts Plug-In will only read this file when the server starts up. After editing the file, quit and restart the server.