当前位置: 移动技术网 > 科技>操作系统>Linux > centos7安装tomcat

centos7安装tomcat

2019年11月29日  | 移动技术网科技  | 我要评论

tomcat 服务器是一个免费的开放源代码的web 应用服务器,属于轻量级应用服务器,在中小型系统和并发访问用户不是很多的场合下被普遍使用,是开发和调试jsp 程序的首选。

apache 为html页面服务,而tomcat 运行jsp 页面和servlet。

1.安装epel

yum install epel-release -y

2.安装tomcat

yum install tomcat-native -y

yum install tomcat-* -y

安装jar命令
yum install java-1.8.0-openjdk-devel -y

3.启动tomcat

systemctl start tomcat

systemctl enable tomcat

4.查看监听端口

yum install net-tools -y

netstat -antupl

5.下载测试程序

find / -name webapps

cd /var/lib/tomcat/webapps

wget

查看程序
jar -xvf sample.war

6.写防火墙规则

iptables -i input -p tcp --dport 80 -j accept

iptables -i input -p tcp --dport 8080 -j accept

80端口重定向到8080
iptables -t nat -i prerouting -p tcp --dport 80 -j redirect --to-port 8080

service iptables save

7.测试访问

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网