Tomcat的安装与配置

1.上传或下载jdk安装包:

wget 下载链接

2.解压到“/usr/local”路径中:

tar xzvf /srv/ftp/apache-tomcat-9.0.19.tar.gz -C /usr/local/

3.为了方便管理,重命名为“tomcat”:

mv /usr/local/apache-tomcat-9.0.19/ /usr/local/tomcat

vim /etc/profile  :配置环境变量

4.修改tomcat配置文件:

1.打开配置文件:vim /usr/local/tomcat/bin/setclasspath.sh

2.追加:JAVA_HOME、JRE_HOME环境内容

export JAVA_HOME=/usr/local/jdk

export JRE_HOME=/usr/local/jdk/jre

5.tomcat的启动与关闭:

启动:/usr/local/tomcat/bin/catalina.sh start

关闭:/usr/local/tomcat/bin/catalina.sh stop

6.查看端口:默认8080

netstat -nptl

7.修改端口:

1.打开配置文件:vim /usr/local/tomcat/conf/server.xml

2. <Connector port="80" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443" />

7.打开“Manager App”:

7.1.添加用户和权限:

打开文件:vim /usr/local/tomcat/conf/tomcat-users.xml

在<tomcat-users>添加:

<role rolename ="manager-gui"/>

<user username="tomcat" password="123456" roles="manager-gui"/>

7.2.打开“context.xml”文件,注释掉地址限制:

打开文件:vim /usr/local/tomcat/webapps/manager/META-INF/context.xml

注释掉:

<!--  <Valve className="org.apache.catalina.valves.RemoteAddrValve"

         allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />

-->

8.打war包,通过manager app上传:

jar -cvf balloon.war ./*

posted @ 2019-05-17 21:31  SweetBaby。  阅读(146)  评论(0编辑  收藏  举报