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


 


  • 2021-01-21 13:52:36

    node.js使用Nodemailer发送邮件

    常常看到一些网站有邮箱获取验证码验证注册或者修改密码等,今天也来了解一下在nodejs + express怎么发送电子邮件。使用模块Nodemailer。这里以qq邮箱举例子。

  • 2021-01-21 13:55:53

    Mongodb字段更新$unset操作符

    当使用$操作符匹配任何数组元素,$unset替换指定的元素为null而不是删除掉指定的元素,此行为保持数组大小和位置一直;

  • 2021-01-22 08:30:02

    Android IO简化之Okio库

    如果之前有使用过Okhttp,那么你一定知道底层的IO读取是由square公司开发的Okio库。它补充了Java.io和java.nio的不足,以便能够更加方便,快速的访问、存储和处理你的数据。而在一般的开发中,我们也可以使用Okio来做IO读写,非常方便深得我心

  • 2021-01-22 21:56:48

    emcc生成wasm,wast,bc文件的方法

    Emscripten实现把C/C++文件转成wasm,wast(wasm的可读形式),llvm字节码(bc格式),ll格式(llvm字节码的可读形式)的步骤。

  • 2021-01-22 21:59:34

    emcc编译与部分重要参数选取

    C/C++代码通过emcc编译为字节码,然后根据不同的目标编译为asm.js或wasm。emcc和gcc编译选项类似,例如-s OPTIONS=VALUE、-O等。另外为了适应Web环境,emcc增加了一些特有的选项,如–pre-js 、–post-js 等。

  • 2021-01-22 22:01:19

    Emscripten Compiler Frontend (emcc)

    The Emscripten Compiler Frontend (emcc) is used to call the Emscripten compiler from the command line. It is effectively a drop-in replacement for a standard compiler like gcc or clang.