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
网友评论