安装步骤
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首页查看是否成功