我是靠谱客的博主 贪玩芝麻,最近开发中收集的这篇文章主要介绍redhat mysql运行端口_如何在 Redhat 7 Linux 上使用 firewall-cmd 开启80端口,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

在Redhat 7上80端口默认是被过滤掉的,因此我们仅仅能在本机使用localhost访问这个端口,而不能从其他机器上访问这个端口。如果要打开80端口我们需要添加一个iptables规则,对于RHEL7我们可以使用firewall-cmd命令来添加。首先用以下命令添加80端口:

[root@rhel7 ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent

然后用以下命令重启firewall服务:

[root@rhel7 ~]# firewall-cmd --reload

接下来检查是否添加成功:

[root@rhel7 ~]# iptables-save | grep 80

-A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT

232a8a661ec9549b6bf0b804090c12d9.png

如果你想屏蔽或者移除80端口,也可以用firewall-cmd命令:

[root@rhel7 ~]# iptables-save | grep 80

-A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT

[root@rhel7 ~]# firewall-cmd --zone=public --remove-port=80/tcp --permanent

success

[root@rhel7 ~]# firewall-cmd --reload

success

[root@rhel7 ~]# iptables-save | grep 80

[root@rhel7 ~]#

e04293ad5034a44a6af8bb04ee6b3c3c.png

最后

以上就是贪玩芝麻为你收集整理的redhat mysql运行端口_如何在 Redhat 7 Linux 上使用 firewall-cmd 开启80端口的全部内容,希望文章能够帮你解决redhat mysql运行端口_如何在 Redhat 7 Linux 上使用 firewall-cmd 开启80端口所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(49)

评论列表共有 0 条评论

立即
投稿
返回
顶部