Tomcat Instance Notes
Tomcat can have multiple instances. For these examples I will assume that you have tomcat installed at /usr/local/tomcat
.
Setup
You will need a directory that will be the $CATALINA_BASE
. I'm going to use /usr/local/my-instance
. You will need the following directories:
/usr/local/my-instance/conf
/usr/local/my-instance/logs
/usr/local/my-instance/temp
/usr/local/my-instance/webapps
/usr/local/my-instance/work
# Cheat
mkdir -p /usr/local/my-instance/{conf,logs,temp,webapps,work}
Copy the server.xml
and web.xml
files from your tomcat install, place in your new conf
folder, and modify to your liking. At the very least you will have to make some changes to server.xml
:
- The
<Server>
tag will need a different value for its port. - The
<Connector>
s will need to be on different ports as well (HTTP, AJP, etc).
To start and shutdown you need only to tell tomcat where your new instance is:
CATALINA_BASE=/usr/local/my-instance /usr/local/tomcat/bin/startup.sh
CATALINA_BASE=/usr/local/my-instance /usr/local/tomcat/bin/shutdown.sh
Manager
To have a Tomcat Manager running on your new instance, create $CATALINA_BASE/conf/Catalina/localhost/manager.xml
.
To have it use the same manager and settings/users as your main install:
<Context path="/manager" privileged="true" docBase="/usr/local/tomcat/webapps/manager"/>
Point your UserDatabase
in server.xml
to the tomcat-users.xml
file in your main install:
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="/usr/local/tomcat/conf/tomcat-users.xml"/>