Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The Resin configuration (resin.xml) pasted below achieves the following:

  1. Binds the built-in http server to port 8000
  2. Sets the desired maximum memory allocation (-Xmx512m)
  3. Configures the webapp /path/web/root accessible from and http://(www|www1|www2)
  4. Sets up access logging to /path/to/logs/access.log

This is the Resin configuration:

  <cluster id="app-tier">
      <!-- #1 -->
      <http port="8000"/>
      <!-- #2 -->
    <!-- #3 -->
    <host id='' root-directory="/path/web/root">
      <web-app id="/" />
      <!-- #3 -->
      <!-- #4 -->
      <access-log path="/path/to/logs/access.log" />

I'm switching from Resin to Tomcat and my question is hence:

  • What is the "best practice configuration" for Tomcat to achieve the four things outlined above?
share|improve this question
up vote 1 down vote accepted

I can answer some of these questions.

Changing the port number is done by editing the appropriate <Connector /> element in the conf/server.xml file (see for more information).

Here is what comes out of the box:

<Connector port="8080" protocol="HTTP/1.1"
               redirectPort="8443" />

You could change the port attribute to anything you want.

Changing the heap size, or any other JVM setting, can be done using the JAVA_OPTS environment variable. For example, you could add the following to bin/

# Must go *before* the final line ("exec ...")
export JAVA_OPTS="$JAVA_OPTS -Xmx512m"

I have never set up an access log before. However, it looks like you can do it by un-commenting the appropriate "Valve" in conf/server.xml (see for details).

Example of the commented-out valve from my server.xml file:

<!-- Access log processes all example.
     Documentation at: /docs/config/valve.html -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
       prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>

Lastly, for virtual hosts, I can only point you to the documentation, which is at I hope this is better than nothing :-).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.