home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeWebmaster in a Nutshell, 3rd EditionSearch this book

19.38. mod_vhost_alias

The mod_vhost_alias supports the dynamic configuration of document roots and script directories for virtual hosts. This functionality is useful when a server handles a large number of virtual hosts, usually by varying the subdomain sections of the hostname. Virtual hosts configured under the directives of this module are expected to share the same configuration since they won't have their own <Virtual Directory> sections.

The name of the virtual host is determined by the Host: header in the client request. (This requires UseCanonicalName off.) The IP address is the address assigned to the particular virtual host. The directives of this module use either the host name or IP address and interpolate it to locate unique document and script paths for each host.

The interpolated path parameter for each directive uses a printf-like format string to refashion parts of the virtual hostname or address into a directory. A %-sign followed by a short format specifier represent sections of the name in the interpolated directory. Each word between the dots in a name or address is a section numbered from left to right, starting with one. The whole name is represented by 0 (%0). For example:

%0
The whole name

%2
The second section

%-1
The last section

%-2
The next-to-last section

%3+
The third section and all subsequent sections

Additionally, %p represents the port number.

The settings of this module will be overridden by any mod_alias and mod_userdir settings on the same host names.

VirtualDocumentRoot

VirtualDocumentRoot interpolated_path

[server config, within <VirtualHost>]

Sets the root document directories for matching virtual hostnames.

VirtualDocumentRootIP

VirtualDocumentRootIP interpolated_path

[server config, within <VirtualHost>]

Sets the root document directories for virtual hosts with matching IP addresses.

VirtualScriptAlias

VirtualScriptAlias interpolated_path

[server config, within <VirtualHost>]

Sets the location of CGI directories for matching virtual hostnames.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.