--原来的不动,添加环境变量(.bash_profile)
export JAVA_HOME=/home/public/jdk1.8.0_131
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH

export CATALINA_BASE=/home/otouser/apache-tomcat-7.0.67
export CATALINA_HOME=/home/otouser/apache-tomcat-7.0.67
export CATALINA_TMPDIR=/home/otouser/apache-tomcat-7.0.67/temp

export CATALINA_BASE2=/home/otouser/apache-tomcat-7.0.75
export CATALINA_HOME2=/home/otouser/apache-tomcat-7.0.75
export CATALINA_TMPDIR2=/home/otouser/apache-tomcat-7.0.75/temp

--第一个tomcat不用动

--第二个tomcat进入bin目录执行
sed -i 's/CATALINA_HOME/CATALINA_HOME2/g' *.sh
sed -i 's/CATALINA_BASE/CATALINA_BASE2/g' *.sh
sed -i 's/CATALINA_TMPDIR/CATALINA_TMPDIR2/g' *.sh

(Windows系统是修改bat文件,其实就是把脚本中的变量名称改一下)

--修改第二个tomcat的端口 conf/server.xml

1.将默认8005改为8015
<Server port="8015" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->

2.将默认8080端口改成8081
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->

3.将默认端口8009改成8019
<!-- Define an AJP 1.3 Connector on port 8019 -->
<Connector port="8019" protocol="AJP/1.3" redirectPort="8443" />

--测试网址

http://ip:端口  #这里用8081端口

05-11 13:58