阿里云centos7 用iptables 将Tomcat 8080端口改成80端口

安装步骤

1、安装iptables

yum install iptables-services

注意:阿里云centos7 默认 是使用的firewall,所以要使用iptables需先安装。

2、相看filrwall是否关闭

systemctl status firewalld #查看
systemctl start firewalld #启动
systemctl stop firewalld #关闭
systemctl disable firewalld #开机禁用 
systemctl enable firewalld #开机启用

3、使用iptables -L -n查看端口情况(此步骤可以跳过)

iptables -L -n

效果图如下所示:
在这里插入图片描述
4、把端口加入到iptables中

#进入iptables配置文件
vim /etc/sysconfig/iptables 
#添加端口映射
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT

如下图所示:
在这里插入图片描述
5、重启iptables

systemctl restart iptables.service

6、还需在阿里云控制台上, 添加安全组规则
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
7、在Tomcat首页查看是否成功
在这里插入图片描述

发布了185 篇原创文章 · 获赞 457 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/weixin_42146366/article/details/100150597