美文网首页
虚拟机相关--nginx无法访问

虚拟机相关--nginx无法访问

作者: 剑风i | 来源:发表于2019-08-11 21:42 被阅读0次
1.问题定位

首先在centos下尝试使用命令访问nginx。

curl http://127.0.0.1

如果能够成功获取到nginx的默认主页。
那么,问题基本出在防火墙上,centos 7 的防火墙使用 firewalld。
所以,你需要让 firewalld 放行80端口。

2.修改配置
  • centos7用的firewalld,cent6使用iptables。
  • firewalld默认已经安装并启用了,如果需要nginx可以访问需要执行以下命令:
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --zone=trusted --add-port=80/tcp

文章参考 https://segmentfault.com/q/1010000002678462/a-1020000002678535

相关文章

网友评论

      本文标题:虚拟机相关--nginx无法访问

      本文链接:https://www.haomeiwen.com/subject/afcejctx.html