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


 


  • 2017-02-13 17:50:05

    cURL error 60: SSL certificate problem: unable to get local issuer certificate

    Drupal 8 version uses Guzzle Http Client internally, but under the hood it may use cURL or PHP internals. If you installed PHP cURL on your PHP server it typically uses cURL and you may see an exception with error Peer certificate cannot be authenticated with known CA certificates or error code CURLE_SSL_CACERT (60).

  • 2017-02-16 08:09:01

    HTML中PRE和p的区别

    pre 元素可定义预格式化的文本。被包围在 pre 元素中的文本通常会保留空格和换行符。而文本也会呈现为等宽字体。 <pre> 标签的一个常见应用就是用来表示计算机的源代码。

  • 2017-02-16 15:14:14

    动态加载js和css

    开发过程中经常需要动态加载js和css,今天特意总结了一下常用的方法。

  • 2017-02-17 17:11:24

    mysql插入数据后返回自增ID的方法c

    产生的ID 每次连接后保存在服务器中。这意味着函数向一个给定客户端返回的值是该客户端产生对影响AUTO_INCREMENT列的最新语句第一个 AUTO_INCREMENT值的。这个值不能被其它客户端影响,即使它们产生它们自己的 AUTO_INCREMENT值。这个行为保证了你能够找回自己的 ID 而不用担心其它客户端的活动,而且不需要加锁或处理