Some variables are defined in server.xml for use in the obj.conf file. The following file fragment defines a docroot variable:
<PROPERTY name="docroot" value="/server/docs/class2/acme" >
A docroot variable allows different document root directories to be assigned for different virtual servers. The variable is then used in the obj.conf file. For example:
NameTrans fn=document-root root="$docroot"
Using this docroot variable allows you to define different document roots for different virtual servers within the same virtual server class.
A variable is found in obj.conf when the following regular expression matches:
\$[A-Za-z][A-Za-z0-9_]*
This expression represents a $ followed by one or more alphanumeric characters. A delimited version ("${property}") is not supported. To get a regular $ character, use $$ to have variable substitution.
A special variable, id, is always available within a VS element and refers to the value of the id attribute. It is predefined and cannot be overridden. The id attribute uniquely identifies a virtual server. For example:
<PROPERTY name=docroot value="/export/$id" >
If the id attribute of the parent VS element is myserver, the docroot variable is set to the value /export/myserver.
In a default installation, the following variables are used to configure various aspects of the server's operation. Unlike the $id variable, they are not predefined in the server, and they can be overridden.
The following table lists general server.xml variables. The left column lists variables, and the right column lists descriptions of those variables.
Table 2–53 General Variables
Property |
Description |
---|---|
docroot |
The document root of the virtual server. Typically evaluated as the parameter to the document-root function in the obj.conf file. |
accesslog |
The access log file for a virtual server. |
The following table lists server.xml variables used by the send-cgi function in the obj.conf file. The left column lists variables, and the right column lists descriptions of those variables.
Table 2–54 send-cgi Variables
Property |
Description |
---|---|
user |
The value of the user CGI parameter. |
group |
The value of the group CGI parameter. |
chroot |
The value of the chroot CGI parameter. |
dir |
The value of the dir CGI parameter. |
nice |
The value of the nice CGI parameter. |
For more information about the send-cgi function, see the Sun Java System Web Server 6.1 SP8 NSAPI Programmer’s Guide.
Variables are evaluated when generating specific objectsets for individual virtual servers. Evaluation is recursive: variable values can contain other variables. For example:
... <VSCLASS> ... <VS ...> ... <PROPERTY name=docroot value="$docrootbase/nonjava/$id" > </VS> <VS...> ... <PROPERTY name=docroot value="$docrootbase/java/$id" > </VS> ... <PROPERTY name=docrootbase value="/export" > </VSCLASS> ...
Variables in subelements override variables in the parent elements. For example, it is possible to set a variable for a class of virtual servers and override it with a definition of the same variable in an individual virtual server.