1. 程式人生 > >linux下安裝第二個tomcat

linux下安裝第二個tomcat

如第二個tomcat安裝路徑為:/usr/local/tomcat_2

再 /etc/目錄下的profile 檔案進行編輯

vi /etc/profile

找到文件最末端,進行新增:(對比看看缺少那部分,一般是紅色部分)

export JAVA_HOME="/usr/java/jdk1.7.0_04" export PATH= ".:$PATH:$JAVA_HOME/bin" export CLASSPATH= "$JAVA_HOMEb:$JAVA_HOME/jreb" ##########first tomcat########### CATALINA_BASE=/usr/local/tomcat CATALINA_HOME=/usr/local/tomcat TOMCAT_HOME=/usr/local/tomcat export CATALINA_BASE CATALINA_HOME TOMCAT_HOME ##########first tomcat############ ##########second tomcat########## CATALINA_2_BASE=/usr/local/tomcat_2
CATALINA_2_HOME=/usr/local/tomcat_2 TOMCAT_2_HOME=/usr/local/tomcat_2 export CATALINA_2_BASE CATALINA_2_HOME TOMCAT_2_HOME ##########second tomcat########## 儲存退出。#source /etc/profile

再來到第二個tomcat的bin目錄下,再catalina.sh中加入:

export JAVA_HOME="/usr/java/jdk1.7.0_04" export PATH=".:$PATH:$JAVA_HOME/bin" export CLASSPATH= "$JAVA_HOMEb:$JAVA_HOME/jreb" ###以上三個環境變數就是JAVA的環境變數### export CATALINA_BASE=$CATALINA_2_BASE export CATALINA_HOME=$CATALINA_2_HOME
更改埠:
第一個tomcat,保持解壓後的原狀不用修改,  第二個tomcat,修改server.xml配置和第一個不同的啟動、關閉監聽埠。 修改後示例如下:   <Server port="9005" shutdown="SHUTDOWN">                埠:8005->9005 <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->     <Connector port="9080" maxHttpHeaderSize="8192"        埠:8080->9080 maxThreads="150" minSpareThreads="25" maxSpareThreads="75"                enableLookups="false" redirectPort="8443" acceptCount="100"                connectionTimeout="20000" disableUploadTimeout="true" /> <!-- Define an AJP 1.3 Connector on port 8009 -->     <Connector port="9009"                                  埠:8009->9009                enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />

再server.xml中修改紅色字型部分

<Host name="localhost"  appBase="/xiangmu_lujing"
            unpackWARs="true" autoDeploy="true">
<Context path="" debug="0" docBase="/xiangmu_lujing" reloadable="true" />
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->


        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />


      </Host>

文章參考:http://blog.csdn.net/qq_29246225/article/details/52250813

http://blog.csdn.net/tanjie_123/article/details/52350372