tomcat多实例
作者:互联网
NGINX+Tomcat
tomcat多实例
安装jdk环境
[root@localhost opt]# ls
apache-tomcat-9.0.16.tar.gz jdk-8u201-linux-x64.rpm
将apache-tomcat-9.0.16.tar.gz解压
[root@localhost opt]#tar zxvf apache-tomcat-9.0.16.tar.gz
[root@localhost opt]#rpm -qpl jdk-8u201-linux-x64.rpm
##查看安装路径
[root@localhost opt]# cd /usr/java/jdk1.8.0_201-amd64/
[root@localhost jdk1.8.0_201-amd64]#vim /etc/profile
#添加环境变量
export JAVA_HOME=/usr/java/jdk1.8.0_201-amd64
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH=$JAVA_HOME/bin:$PATH
[root@localhost opt]# source /etc/profile
[root@localhost opt]# java -version
[root@localhost opt]#mkdir /usr/local/tomcat
[root@localhost opt]#mv apache-tomcat-9.0.16 /usr/local/tomcat/tomcat1
[root@localhost opt]#cd /usr/local/tomcat/
[root@localhost tomcat]#cp -a tomcat1/ tomcat2
[root@localhost tomcat]#ls
tomcat1 tomcat2
[root@localhost tomcat]#vim tomcat2/conf/server.xml
#只需要修改tomcat2中的主配置文件
22 <Server port="8006" shutdown="SHUTDOWN">
69 <Connector port="8081" protocol="HTTP/1.1"
116 <Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />
将下面坏境变量分别加入到startup.sh 和 shutdown.sh
[root@localhost local]# vim /usr/local/tomcat/tomcat1/bin/startup.sh
[root@localhost local]# vim /usr/local/tomcat/tomcat2/bin/startup.sh
[root@localhost local]# vim /usr/local/tomcat/tomcat1/bin/shutdown.sh
[root@localhost local]# vim /usr/local/tomcat/tomcat2/bin/shutdown.sh
#修改启动脚本和关闭脚本
#tomcat1
export CATALINA_HOME1=/usr/local/tomcat/tomcat1
export CATALINA_BASE1=/usr/local/tomcat/tomcat1
export TOMCAT_HOME1=/usr/local/tomcat/tomcat1
#tomcat2
export CATALINA_HOME2=/usr/local/tomcat/tomcat2
export CATALINA_BASE2=/usr/local/tomcat/tomcat2
export TOMCAT_HOME2=/usr/local/tomcat/tomcat2
启动startup.sh 和 shutdown.sh
[root@localhost local]# bash /usr/local/tomcat/tomcat1/bin/startup.sh
[root@localhost local]# bash /usr/local/tomcat/tomcat2/bin/startup.sh
标签:tomcat,local,实例,usr,root,localhost,tomcat2 来源: https://blog.csdn.net/STARDEIT/article/details/121353193