Web Server Setup tutorial
Mapping Requests to Resources General information about the virtual host/directory mechanism

## Listening Interface Concepts

- A single Virtuoso server can accept HTTP requests on multiple interfaces.
- Listening interfaces are defined via a virtual directory mechanism (not based on INI setting).
- Virtual directory operation can be stopped or started without restarting the server engine.
- The request accepted on a given interface can be processed in a separate Web space.

## Virtual Host

- The term Virtual Host refers to the practice of maintaining more than one server on one machine, as differentiated by their apparent host name. For example, it is often desirable for companies sharing a web server to have their own domains, with web servers accessible as www.company1.com and www.company2.com, without requiring the user to know any extra path information. The Virtual host can be IP-based or non-IP.
- The IP-based (named in this document as multihosting) refers to the practice of making one machine listen on different interfaces and respond with different pages.
- The non-IP (named virtual hosting) refers to the practice where one machine is allocated more than one DNS alias. The web content served can then be based on the alias that the client contacted, as identified by the 'Host' HTTP header field.
- A single Virtuoso server can map requests into multiple spaces of web pages based on the interface to which the requests come (multihosting) or on the Host HTTP/1.1 header (virtual hosting).
- A single physical interface can map multiple virtual hosts.
- The virtual host name must be defined also in Domain Name Server as an alias of the official host name.

## Attributes

- Logical Path - The path part from URL which user-agent wants.
- Mapped Path - Defacto location of requested Web resource.
- Is in DAV - The Virtuoso server has space for Distributed Authoring & Versioning (DAV see: rfc2518 for details) under "/DAV" URL. The logical path can me mapped in to this space.
- Default page - The name of page or resource on Web server to show if a directory/folder is requested. It applies to the entire subdirectory tree.
- Is browseable - If no default page specified or page does not exist, then show directory content. Warning: This setting can raise security problems, because all directory content will be shown.

## Security

- The Web server has access to the file system directory (see ServerRoot INI setting) using the privileges of the user who is running it.
- Access to the WebDAV repository can be restricted to only special accounts, as each resource/folder can have different permissions applied.
- Execution in a mapped path can be enabled/disabled.
- Basic and Digest HTTP authentication schemes can be used.
- HTTPS listeners can be started.
- User-agent's certificate can be requested and checked.

## Authentication Function

- An application dependant PL function for HTTP authentication can be defined for each path mapping.
- The authentication function can be used to restore session variables.
- The built-in authentication functions can be used.

## Request Postprocessing Function

- An application dependant PL function can be defined for each path mapping to store the session variables (in session table).

## Database User Accounts for execution of active content

- Database User Account for VSP: For each path mapping, a different Database account can be supplied. The VSP will be executed on behalf of this account.
- Database user account for SOAP: For each path mapping, the SOAP calls can be assign to a different Database account. The WSDL schema will show only PL procedures granted to this account.

## Example Listen host & Virtual host mappings

It is possible to have a mapping in the file system /www1/ for http://www.a.com/ requests. In this case we will specify the listen host www.a.com (the port default is 80), logical path / and physical location /www1/.

In some cases more than one web server is needed on the same machine. A second DNS alias www.b.com can be routed to the www.a.com. A mapping for this alias can then be: listen host is again www.a.com but virtual host is www.b.com and physical location can be a /www2/ under HTTP root directory. When a User-Agent requests the http://www.b.com/ it will send a 'Host' header field, in this field value will be 'www.b.com'. The web server will find a second map and will try to process the pages under /www2/.

## Finding the closest applicable mapping

Its possible to define more than one mapping for one virtual/listen host combination. In this case the closest match to the request is used. For example with the following mappings:

Logical Path | Physical Path
--- | ---
www.a.com/ | /www/a
www.a.com/a | /www/b

Gets the following mapping:

Request | Physical Path
--- | ---
http://www.a.com/a/ | /www/b
http://www.a.com/other | /www/a/other

The Web server will find the closest path match when processing the logical to physical mapping.