centos中安装多个tomcat

借鉴网址:http://wbande.blog.163.com/blog/static/303812572010511101812972<wbr>/</wbr>

用的版本仍旧是tomcat6.0

原有的为:tomcat6.0,新增加的为tomcat6.0-2

1在/etc/profile中添加以下粗体的配置

#原有的tocmat配置

TOMCAT_HOME=/usr/local/tomcat6.0
CATALINA_HOME=/usr/local/tomcat6.0
CATALINA_BASE=/usr/local/tomcat6.0
export TOMCAT_HOME CATALINA_HOMECATALINA_BASE

#添加的tocmat配置,可照此样添加多个tomcat

TOMCAT_2_HOME=/usr/local/tomcat6.0-2
CATALINA_2_HOME=/usr/local/tomcat6.0-2
CATALINA_2_BASE=/usr/local/tomcat6.0-2
export TOMCAT_2_HOME CATALINA_2_HOMECATALINA_2_BASE

2 修改tomcat6.0-2的bin/shutdown.sh,在exec"$PRGDIR"/"$EXECUTABLE" stop"$@"这行前边添加如下配置:

export JAVA_HOME=/usr/local/jdk1.6
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib
export CATALINA_HOME=$CATALINA_2_HOME
exportCATALINA_BASE=$CATALINA_2_BASE

3 修改tomcat6.0.-2的bin/startup.sh,在exec"$PRGDIR"/"$EXECUTABLE" stop"$@"这行前边添加如下配置:

export JAVA_HOME=/usr/local/jdk1.6
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib
export CATALINA_HOME=$CATALINA_2_HOME
exportCATALINA_BASE=$CATALINA_2_BASE

4修改tocmat6.0-2的conf/server.xml,更改端口

-----------------------------tocmat6.0-2的server.xml配置如下----------------


<server port="&lt;SPAN style=" color:="">9005&lt;/SPAN&gt;"shutdown="SHUTDOWN"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="FONT-FAMILY: comic sans ms,sans-serif"&gt;&lt;SPAN style="FONT-SIZE: small"&gt;&lt;FONT size=2face=""&gt;&lt;ListenerclassName="org.apache.catalina.core.AprLifecycleListener"SSLEngine="on" /&gt;&lt;BR&gt;&lt;ListenerclassName="org.apache.catalina.core.JasperListener"/&gt;&lt;BR&gt;&lt;ListenerclassName="org.apache.catalina.core.JreMemoryLeakPreventionL<wbr>istener"/&gt;&lt;BR&gt;&lt;ListenerclassName="org.apache.catalina.mbeans.ServerLifecycleListener"/&gt;&lt;BR&gt;&lt;ListenerclassName="org.apache.catalina.mbeans.GlobalResourcesLifecycle<wbr>Listener"/&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="FONT-FAMILY: comic sans ms,sans-serif"&gt;&lt;SPAN style="FONT-SIZE: small"&gt;&lt;FONT size=2face=""&gt;&lt;GlobalNamingResources&gt;&lt;BR&gt;&lt;Resourcename="UserDatabase"auth="Container"&lt;BR&gt;type="org.apache.catalina.UserDatabase"&lt;BR&gt;description="Userdatabase that can be updated andsaved"&lt;BR&gt;factory="org.apache.catalina.users.MemoryUserDatabaseFactor<wbr>y"&lt;BR&gt;pathname="conf/tomcat-users.xml"/&gt;&lt;BR&gt;&lt;/GlobalNamingResources&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="FONT-FAMILY: comic sans ms,sans-serif"&gt;&lt;SPAN style="FONT-SIZE: small"&gt;&lt;FONT size=2face=""&gt;&lt;Servicename="Catalina"&gt;&lt;BR&gt;&lt;BR&gt;&lt;Connector port="&lt;SPANstyle="COLOR: rgb(255,0,0)"&gt;9080&lt;/SPAN&gt;"protocol="HTTP/1.1" &lt;BR&gt;connectionTimeout="20000"&lt;BR&gt;redirectPort="8443" URIEncoding="UTF-8"maxHttpHeaderSize="8192" maxThreads="1000" enableLookups="false"compression="on" compressionMinSize="2048"compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain"disableUploadTimeout="true" useBodyEncodingForURI="true"/&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="FONT-FAMILY: comic sans ms,sans-serif"&gt;&lt;SPAN style="FONT-SIZE: small"&gt;&lt;FONT size=2face=""&gt;&lt;Connector port="&lt;SPAN style="COLOR:rgb(255,0,0)"&gt;9009&lt;/SPAN&gt;" protocol="AJP/1.3"connectionTimeout="20000"&lt;BR&gt;redirectPort="8443"/&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="FONT-FAMILY: comic sans ms,sans-serif"&gt;&lt;SPAN style="FONT-SIZE: small"&gt;&lt;FONT size=2face=""&gt;&lt;Engine name="Catalina"defaultHost="localhost"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="FONT-FAMILY: comic sans ms,sans-serif"&gt;&lt;SPAN style="FONT-SIZE: small"&gt;&lt;FONT size=2face=""&gt;&lt;RealmclassName="org.apache.catalina.realm.UserDatabaseRealm"&lt;BR&gt;resourceName="UserDatabase"/&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="FONT-FAMILY: comic sans ms,sans-serif"&gt;&lt;SPAN style="FONT-SIZE: small"&gt;&lt;FONT size=2face=""&gt;&lt;Host name="localhost"appBase="webapps"&lt;BR&gt;unpackWARs="true"&lt;BR&gt;xmlValidation="false"xmlNamespaceAware="false"&gt;&lt;BR&gt;&lt;/Host&gt;&lt;BR&gt;&lt;/Engine&gt;&lt;BR&gt;&lt;/Service&gt;&lt;BR&gt;</wbr></wbr></wbr></server>

访问项目:http://Ip:9080/

你可能感兴趣的:(centos中安装多个tomcat)