nginx配置启动错误总结

这里写自定义目录标题

  • nginx报403启动错误

nginx报403启动错误

第一步,首先查看一下错误log,在logs目录下的error.log文件中查找是否有明显错误,一般情况下是由于权限引起,类似的报错如下:

2019/10/12 08:27:55 [error] 46315#0: *32 "/home/test/BdCloudRm/SysAdmin/intro.html" is forbidden (13: Permission denied), client: 10.212.130.81, server: 10.212.130.18, request: "GET / HTTP/1.1", host: "10.212.130.18"
2019/10/12 08:27:55 [error] 46315#0: *32 open() "/home/test/BdCloudRm/SysAdmin/favicon.ico" failed (13: Permission denied), client: 10.212.130.81, server: 10.212.130.18, request: "GET /favicon.ico HTTP/1.1", host: "10.212.130.18", referrer: "http://10.212.130.18/"
2019/10/12 08:27:56 [error] 46315#0: *32 "/home/test/BdCloudRm/SysAdmin/intro.html" is forbidden (13: Permission denied), client: 10.212.130.81, server: 10.212.130.18, request: "GET / HTTP/1.1", host: "10.212.130.18"
2019/10/12 08:27:56 [error] 46315#0: *32 open() "/home/test/BdCloudRm/SysAdmin/favicon.ico" failed (13: Permission denied), client: 10.212.130.81, server: 10.212.130.18, request: "GET /favicon.ico HTTP/1.1", host: "10.212.130.18", referrer: "http://10.212.130.18/"

第二步,先不着急修改对应文件的访问权限,先使用命令查看一下nginx启动用户与文件配置用户是否一致

[root@localhost logs]# ps aux | grep "nginx: worker process"
root      46547  0.0  0.0  23028  1728 ?        S    08:32   0:00 nginx: worker process
root      47583  0.0  0.0 112664   972 pts/11   S+   08:49   0:00 grep --color=auto nginx: worker process
//当前用户是root启动,nginx配置读取用户在nginx.conf中

user  root;//保证该配置与启动用户一致
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

第三步,上述问题排查掉之后可以考虑修改nginx访问目录的权限,使用chmod 777 修改访问权限

你可能感兴趣的:(nginx)