kief.com

Sporadically delivered thoughts on Continuous Delivery

Configuring the Tomcat Manager Webapp

| Comments

I like to have the Tomcat manager webapp installed on each instance, so I can play with the webapps, and see how many active sessions there are. To do this, make a file called manager.xml file in $CATALINA_BASE/conf/[Engine]/[hostname]/. Following the default Tomcat installation, this would be $CATALINA_BASE/conf/Catalina/localhost.

An example of what mine typically looks like is below:

<Context path="/manager"
        docBase="/usr/local/tomcat/server/webapps/manager"
        debug="0"
        privileged="true">

    <ResourceLink name="users"
            global="UserDatabase"
            type="org.apache.catalina.UserDatabase"/>

    <Valve className="org.apache.catalina.valves.RemoteAddrValve"
            allow="127.0.0.1,192.168.100.100"/>

</Context>

The key bit is the docBase attribute, which needs to point to the webapp in the Tomcat installation directory. I add a RemoteAddrValve to keep evil people from trying to break into the manager.

You’ll also need to add a user account with permission to use the manager. Put a file called tomcat-users.xml into the conf directory of the Tomcat instance, which should have something like the following:

<tomcat-users>
  <role rolename="manager"/>
  <user username="admin" password="hard2Guess" roles="manager"/>
</tomcat-users>

Finally, your server.xml file needs to have a UserDatabase configured. This is in the example configuration files from the Tomcat installation.

Comments