The Virtual Hosts File |
|
The Virtual Hosts file stores the configuration info for the rhdaemon.
You can open this file from the "File" menu of RHConsole or by opening
/boot/home/config/settings/virtual_hosts.
Changes made to the Virtual Hosts file do not take effect until the server is
restarted. The elements defined in the Virtual Hosts file includes the
following: Servers, Virtual Hosts, Virtual Resources, and Realms.
- Server
An independant web server with its own collection of virtual hosts.
Each server runs on its own TCP port; the default TCP port for HTTP is port 80.
Other ports may be accessed by using the following syntax from your browser:
http://host-name:port/path
Example: http://www.foo-bar.org:2100/
- Virtual Host
It is possible for one web server to service multiple
domain names. For example, you may own the domains www.foo-bar.org and
www.mr-happy.com and wish to host both on the same machine. Virtual Hosts
provides the mechanism by which this can be done. If the host was not specified
in the request or the host specified does not exist in the Virtual Hosts file, the
Virtual Host named Default-Host is used.
- Webroot
Each Virtual Host has its own virtual root directory. For example,
if the Webroot of the Virtual Host www.foo-bar.org was "/boot/home/public_html/",
the URL http://www.foo-bar.org/foo/bar.html would refer to the file
"/boot/home/public_html/foo/bar.html" on your computer. It is not possible to access
files outside of the virtual root directory without using a symbolic link.
- Index
This is the Index Document to be used for each Virtual Host. It will be appended
to the URL before parsing if a directory URL was requested. For example,
if the Webroot of the Virtual Host www.foo-bar.org was "/boot/home/public_html/"
and the Index Document was "index.shtml", the URL http://www.foo-bar.org/ would
return the file "/boot/home/public_html/index.shtml" on your computer. The Index Document
is set to "index.html" by default if not specified.
- Virtual Resource
Each Virtual Host maintains its own list of Virtual Resources.
Virtual Resources provides the means to define resouces which don't actually exist
as a file on your computer. A virtual resource is created dynamically by one of the
loaded add-on modules as needed. For example, the RHDirectoryHandler can
create a directory listing when the "index.html" file is missing and it can
create PNG images for Tracker icons.
Virtual Resources are also used to define Virtual MIME types. A Virtual MIME type
changes the MIME type of a file for the purpose of selecting which add-on module
to use. For example, all files ending in ".cgi" could be treated as CGIs instead
of their native MIME types.
- Realm
Each Virtual Host has a list of Realms associated with it.
When a resource is requested for which public access has not been granted, the
resource's Realm defines the user name and password required to access the
resource. Realm membership is defined by one or more file patterns. If
no Realms are defined for a Virtual Host, all files belong to the Realm "Sherwood."
"Sherwood" has the same user name and password as set in the Network Preferences
panel.
The elements have the following type of hiearchal structure:
- Server 1
- Virtual Host 1
- Virtual Resource 1
- Virtual Resource 2
- Virtual Resource 3
- Realm 1
- Realm 2
- Virtual Host 2
- Virtual Resource 1
- Virtual Resource 2
- Realm 1
- Server 2
- Virtual Host 1
- Virtual Resource 1
- Realm 1
The file is composed of a series of lines with one element on each line. Lines
starting with the '#' character are treated as comments and are ignored. Each line
has the following format:
command: fieldName1=fieldValue1 fieldName2=fieldValue2 ...;
When Virtual Resources or Realms are searched for a match, they are searched
in the same order as they appear in the virtual hosts file. Each command has a
set of fields which it accepts. Virtual Resources store any undefined fields in
a list of Extras, which are passed to the invoked add-on module.
Commands
- Server - Define a new server.
- port - The TCP port on which the server is to listen.
- Host - Define a new Virtual Host.
- host - The host name of the virtual host.
- webroot - The root directory of this host; an absolute directory
on your computer.
- index - Name of the file to be used as directory index. If not defined, "index.html" will be used.
- VRes - Define a new Virtual Resource.
- pattern - One or more patterns may be defined for each virtual
resource. The pattern may contain the wild-card characters '*' and '?'.
- type - The MIME type of the virtual resource.
- real - When set to true, pattern is only matched if a real
file was found. This is used to set the virtual MIME type of a resource.
When set to false, the pattern is only checked if a real resource was not
found. Such a resource must be created by an add-on module.
- extras - Any field which is not one of the above is considered an
extra field. Such fields are passed to the invoked add-on module and are
treated in a module specific manner.
- Realm - Define a new Realm.
- name - The unique name of the realm.
- pattern - One or more patterns may be defined. If the path
of a resource matches the pattern, it is considered within this realm. The
pattern may contain the wild-card characters '*' and '?'.
- user - The user name for this realm.
- passwd - The password for this realm.
Robin Hood Web Server for BeOS
Copyright © 1999-2001
The Robin Hood Development Team (see Revision History for details)
BeOS is a registered trademark of Be Inc.