背景:

机房断电后导致机器关机重启,原先访问的地址访问不了,使用终端能访问到该服务器,服务启起来后,用curl + 地址能访问,但在外部浏览器访问不了该地址;

首先想到了端口限制----防火墙

参考博客: https://www.cnblogs.com/zxg-blog/p/9835263.html

 

1.查看防火墙是否启动:

1 systemctl status firewalld

linux 防火墙 firewall 设置linux 防火墙 firewall 设置

 

如图:

active(running)为启动防火墙状态,inactive(dead)为关闭状态

 

2.启动、关闭、重启命令

1 service firewalld restart
2 service firewalld start
3 service firewalld stop

 

3.删除端口(需要在防火墙开启状态执行)

1 firewall-cmd --permanent --add-port=端口号/tcp
2 firewall-cmd --permanent --remove-port=端口号/tcp

 

4.修改后重启生效

1 firewall-cmd --reload

或 2中 重启

 

再次访问改地址,页面正常访问

 

相关文章:

  • 2022-12-23
  • 2021-11-18
  • 2021-10-09
  • 2021-08-30
  • 2021-11-06
  • 2021-05-21
猜你喜欢
  • 2021-07-05
  • 2022-02-14
  • 2022-03-02
  • 2022-12-23
  • 2022-01-18
  • 2021-06-27
  • 2022-02-08
相关资源
相似解决方案