View Source

                                                                                                                                                                                                                                                                                                                                      *Back to [[Book|Administrator's Configuration File Reference#cfr]]     [[Topic|Administrator's Configuration File Reference#chap2]]*
h2. Overview of {{server.xml}}
The {{server.xml}} file contains most of the configuration information needed to run the server. The {{server.xml}} file is located in the _instance_dir_{{/config}} directory. The encoding is UTF-8 to maintain compatibility with regular UNIX text editors.

h3. {{sun-web-server_7_0.xsd}}

The {{sun-web-server_7_0.xsd}} schema validates the format and content of the {{server.xml}} file. The schema enforces type checks. For example, it ensures that the {{ip}} element specifies a valid IP address. The {{sun-web-server_7_0.xsd}} file is located in the {{_install_dir_/lib/dtds}} directory.

h3. Editing {{server.xml}}

The structure of {{server.xml}} is a hierarchy, with {{server}} as the topmost element. The {{server}} element has many subelements, many of which have subelements of their own.

In general, you do not need to edit {{server.xml}} directly. Instead, use the Admin Console and the {{wadm}} command-line interface to change values in {{server.xml}}. Using {{wadm}} when creating scripts to change {{server.xml}} assures you of forward compatibility. If you do edit {{server.xml}} directly, exercise caution to make sure that the resulting {{server.xml}} file is valid.

h4. Editing Element Values

To change the values in {{server.xml}}, change the value between the tags associated with the element you are editing. For example, to change the log level from {{info}} to {{fine}}, find the {{log}} child element of the {{server}} element. In this example, you see the following lines:
{code}
<log>
<log-file>../logs/errors</log-file>
<log-level>info</log-level>
</log>
{code}

To change the log level from {{info}} to {{fine}}, change the line:

{{&lt;log-level>info&lt;/log-level>}}

to:

{{&lt;log-level>fine&lt;/log-level>}}

After you make changes to the {{server.xml}} file, you must deploy your configuration for most changes to take effect. Use the command-line interface command {{wadm pull-config}} to pull the modified {{server.xml}} file, then use the Admin Console or the {{wadm deploy-config}} command to deploy your changes. For some changes, you must restart the server before they take effect. For information on which changes require a restart and which do not, see [Dynamic Reconfiguration].

h4. Adding Elements

To add a new element to {{sever.xml}}, add the element and any required subelements. Elements begin with a tag, for example {{&lt;virtual-server>}}, and end with the closing tag, for example {{&lt;/virtual-server>}}. The tags are case-sensitive.

h4. Validating server.xml

After editing {{server.xml}}, Web Server automatically validates the XML when you start or dynamically reconfigure a the server.

You can also use the {{&ndash;cofigtest}} option of the {{startserv}} script to validate your configuration. From the instance's {{bin}} directory, run:

{noformat:borderStyle=dashed} startserv -configtest {noformat}

The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact