089-Nginx 的403报错的解决思路

针对报错: 神马,又遇403?  

2018/04/04 16:42:22 [error] 8830#0: *9 open() "/application/nginx-1.6.3/html/favicon.ico" failed (13: Permission denied), client: 10.38.238.234, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "10.0.137.143", referrer: "http://10.0.137.143/"

解决思路:

1.由于启动用户和nginx工作用户不一致所致

[root@t-red7 logs]# ps aux | grep "nginx: worker process" |awk '{print $1}'
root
root

2将nginx.config的user改为和启动用户一致,

命令:vi conf/nginx.conf

3.缺少index.html或者index.php文件,就是配置文件中index index.html index.htm这行中的指定的文件

server {  

 listen       80;  

server_name  localhost;  

index  index.php index.html;  

root  /data/html/;

}

4.权限问题,如果nginx没有web目录的操作权限,也会出现403错误。

chmod -R 777  /data/html

5. 防火墙原因

查看:/usr/sbin/sestatus

将SELINUX=enforcing 修改为 SELINUX=disabled 状态

reboot 

猜你喜欢

转载自my.oschina.net/u/3635512/blog/1789998