阿里云ECS服务器配置好环境了公网IP不能访问时,CentOS防火墙端口操作 ,以及阿里云服务器设置安全组

在配置好服务器之后,访问公网IP,结果一直显示此页面:
在这里插入图片描述
当tomcat启动成功后,访问web服务器,请求失败。导致失败的原因之一可能就是防火墙将8080端口或者其他端口拦截掉了,我们需要重新开放8080或者其他端口,不建议关闭防火墙。
CentOS7之后,防火墙从iptables变成了firewalld。

若tomcat防火墙和启动正常,仍无法访问tomcat,那你就要去看一下安全组的设置

安全组设置

firewalld防火墙基本操作:

1.查看防火墙状态:

systemctl status firewalld或者 firewall-cmd --state
2.查看开放端口列表

firewall-cmd --list-ports
3.在指定区域打开端口(记得重启防火墙)(永久生效再加上 --permanent)

firewall-cmd --zone=public --add-port=8080/tcp

4.启动防火墙

systemctl start firewalld

5.禁用防火墙

systemctl stop firewalld

6.设置开机启动

systemctl enable firewalld

7.停止并禁用开机启动

sytemctl disable firewalld

8.重启防火墙

firewall-cmd --reload

9.查看版本

firewall-cmd --version

10.查看帮助

firewall-cmd --help

参考博客:
linux centos7安装tomcat7以及遇到坑的解决办法

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章