CentOS 7.0 配置防火墙

2018-01-16 15:36:27

前一阵子被一个蜜汁 bug 困扰:Node.js 代码能在服务器上跑起来,但从浏览器却无法访问服务器 80 端口。于是在本地玩了一周。今天突然想到可能是防火墙的配置问题。

 

 

之前用的 iptables 来管理的防火墙,后来发现 CentOS 7.0 中已经用 firewalld 取代

iptables 了,于是与时俱进,停用了

iptables

 

systemctl stop iptables.service

 

然后来启动 firewalld

 

systemctl start firewalld.service

 

给我报了这个错

 

 

Failed to start firewalld.service: Unit firewalld.service is masked.

 

 

查了很久没找到解决办法,于是试着输入了下面这行命令,解决了。

 

systemctl unmask firewalld.service

 

启动 firewalld.service

 

systemctl start firewalld.service

 

80 端口添加到防火墙开放端口中

 

firewall-cmd --permanent --zone=public --add-port=80/tcp

 

重启一遍 firewalld 服务使其生效

 

systemctl restart firewalld.service

 

检查更改是否生效

 

firewall-cmd --zone=public --query-port=80/tcp


 


  • 2020-02-19 23:04:52

    理解Laravel中的pipeline

    pipeline在laravel的启动过程中出现次数很多,要了解laravel的启动过程和生命周期,理解pipeline就是其中的一个关键点。网上对pipeline的讲解很少,所以我自己写一写吧。

  • 2020-02-19 23:08:56

    Laravel 用户认证 Auth(精华)

    很多应用是需要登陆后才能操作,Laravel 提供了一个 auth 工具来实现用户的认证功能。并且有一个 config/auth.php 来配置 auth 工具。大概看一下 auth 工具的常用方法

  • 2020-02-19 23:12:44

    Laravel 从 $request 到 $response 的过程解析二(必读)

    laravel 的请求会组装成 $request 对象,然后会依次经过中间件(前置部分),最终到达 url 指向的控制器方法,然后把返回数据组装为 $response 对象返回,再依次经过中间件 (后置部分),最终返回。

  • 2020-02-19 23:15:24

    PHP 闭包(Closure)

    闭包(Closure)又叫做匿名函数,也就是没有定义名字的函数。比如下面的例子:

  • 2020-02-19 23:26:58

    php array_pop 删除数组最后一个元素实例

    php array_pop函数将数组最后一个单元弹出(出栈),即删除数组的最后一个元素。本文章通过php实例向大家讲解array_pop函数的使用方法。