阿里云服务器配置 Tomcat
往期精彩回顾
01
下载安装Tomcat
https://mirrors.cnnic.cn/apache/tomcat/
http://tomcat.apache.org/whichversion.html
wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.5.54/bin/apache-tomcat-8.5.54.tar.gz
tar zxvf apache-tomcat-8.5.54.tar.gz -C /aliyun/server/
cd /aliyun/server/
mv apache-tomcat-8.5.54 tomcat8
chown -R root .
chgrp -R root .
02
配置Tomcat
vi /etc/profile
export CATALINA_HOME=/aliyun/server/tomcat8
source /etc/profile
cd $CATALINA_HOME/bin
vi catalina.sh
$var _must_ be set to either true or false. OS specific support.
CATALINA_HOME=/aliyun/server/tomcat8
JAVA_HOME=/usr/java/jdk1.8.0_241
JRE_HOME=/usr/java/jdk1.8.0_241/jre
5. 进入tomcat的/conf目录,修改Tomcat配置文件server.xml
cd $CATALINA_HOME/conf
vi server.xml
6. 在阿里云ECS服务器中添加安全组,放行8080端口:
03
安装Tomcat服务
1. 将catalina.sh文件复制到 /etc/init.d/目录下,并命名为tomcat:
cp catalina.sh /etc/init.d/tomcat
2. 更新系统启动项:
update-rc.d tomcat defaults 95
sh startup.sh
service tomcat start
service tomcat stop
http://你的ip:8080