日期:2014-05-16  浏览次数:20683 次

Server Deployment - Apache Tomcat 5.5/6/7
Server Deployment - Apache Tomcat 5.5/6/7

These days, I tried very hard to start and maintain multi tomcats on one linux server.

Download the tomcat zip files from the official website
1. The shell script for starting up tomcat start-tomcat1.sh:
#!/bin/sh

CATALINA_HOME="/home/luohua/tools/shellscript/apache-tomcat-5.5.33"
#CATALINA_HOME="/home/luohua/tools/shellscript/apache-tomcat-7.0.12"
CATALINA_BASE="tomcat1"
export CATALINA_HOME CATALINA_BASE

mkdir -p "${CATALINA_BASE}/logs" "${CATALINA_BASE}/temp"

exec "${CATALINA_HOME}/bin/catalina.sh" run

2. Configuration file in tomcat1 directory:
tomcat1/conf/server.xml(for tomcat5.5):
<Server port="9081" shutdown="SHUTDOWN">
  <Service name="Catalina">
    <Connector port="8083" />
    <Engine name="Catalina" defaultHost="localhost">
      <Host name="localhost" appBase="." debug="100"
            unpackWARs="false" autoDeploy="false"
            xmlValidation="false" xmlNamespaceAware="false"/>
    </Engine>
  </Service>
</Server>

tomcat3/conf/server.xml(for tomcat7):
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
  <Service name="Catalina">
    <Connector port="8085" />
    <Engine name="Catalina" defaultHost="localhost">
      <Host name="localhost"  appBase="."
            unpackWARs="false" autoDeploy="false"
            xmlValidation="false" xmlNamespaceAware="false">
      </Host>
    </Engine>
  </Service>
</Server>

tomcat3/conf/*, other configuration file in this directory are copied from the original directory.

3. war package configuration
tomcat1/conf/Catalina/localhost/easymarket.xml:
<Context path="/easymarket" docBase="/home/luohua/tools/shellscript/apps/easymarket.war"
        debug="0" privileged="true">
</Context>

4. properties file configuration
I put these properties files in tomcat directory
for tomcat5.5, apache-tomcat-5.5.33/common/classes
for tomcat5.0.12, apache-tomcat-7.0.12/lib

references:
http://hi.baidu.com/luohuazju/blog/item/907cb9348c3bd23d5bb5f59a.html
http://hi.baidu.com/luohuazju/blog/item/0b1cb1a4d9f1d8f19152ee54.html
http://hi.baidu.com/luohuazju/blog/item/0740fc228bb58aa24723e839.html