【Nginx—常见故障集合】

1.Nginx服务没有运行

80端口没有开
重启nginx服务 systemctl restart nginx

16952149-d09b5c52b52239bd.png
image

2.查看详细Nginx错误提示 检查语法 nginx-t

一般宝花括号说明配置文件内容语法错误了

16952149-08722306b92573a4.png
image

3./etc/hosts文件域名没有解析

16952149-4b421eb0a2a674fa.png
image

4.server_name没有以分号结尾 ";"

treminated 结束
16952149-3f46eaae8312ee1e.png
image

5.报错—404 找不到

站点目录可能没有创建,或者nginx.conf配置文件站点目录写错了
16952149-322377177f31d6f8.png
image

6.报错—403 权限拒绝

Forbidden 权限拒绝
16952149-eb4c887515cf9e70.png
image

模拟错误:站点目录权限修改为000 测试完后改回644

[09:34 root@web01 ~]# ll  /usr/share/nginx/html/www/
total 4
-rw-r--r-- 1 root root 15 Jun  5 09:00 index.html
[09:35 root@web01 ~]# curl www.oldboy.com
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.16.0</center>
</body>
</html>

7.报错—403 首页文件不存在

首页文件不存在 默认是找首页文件
16952149-7dab371f5ca5a497.png
image

8. 无法分配制度的ip地址

本地没有10.0.0.9 的ip
10.0.0.9:80 (failedCannot assign)

9.nginx已经启动了,在使用80端口

只是提示,不是报错

16952149-71dcc8a3a069d74c.png
image

转载于:https://www.jianshu.com/p/74656ab9fa4b

猜你喜欢

转载自blog.csdn.net/weixin_34077371/article/details/91264385