检查nginx服务是否启动
ps -ef | grep nginx
可以看到nginx 服务已经启动成功,但是在浏览器还是无法访问

netstat -ntlp
查看80-端口是否被分配给了Nginx

我们需要修改防火墙配置,开启
Nginx 外网端口
访问开启防火墙
systemctl start firewalld
调整防火墙规则的配置,开启 80 段端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
命令解释:
--zone #作用域
--add-port=80/tcp #添加端口,格式为:端口/通讯协议
--permanent #永久生效,没有此参数重启后失效
重启防火墙
systemctl restart firewalld.service
我使用阿里云的安全组入网规则需要添加80端口的规则


网友评论