【发布时间】:2017-04-21 17:21:21
【问题描述】:
由于某种原因,我在使用 nginx 和 rhel6 读取文件时遇到权限被拒绝错误,这是我的日志文件输出
tail -f /var/log/nginx/ph-repo.error.log
日志说
"/opt/nginx/nginx-1.8.0-1.el6.ngx.x86_64.rpm" failed (13: Permission denied), client: 10.20.5.236, server: my-repo, request: "GET /nginx/nginx-1.8.0-1.el6.ngx.x86_64.rpm HTTP/1.1", host: "my-repo"
当我检查文件的权限时,它是 777
[root@my-repo]# ls -l nginx/nginx-1.8.0-1.el6.ngx.x86_64.rpm
-rwxrwxrwx. 1 root root 360628 Oct 23 02:59 nginx/nginx-1.8.0-1.el6.ngx.x86_64.rpm
nginx进程也以root身份运行
[root@ph-repo]# ps -elf | grep nginx
1 S root 1527 1 0 80 0 - 11195 rt_sig 09:48 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
5 S root 1528 1527 0 80 0 - 11378 ep_pol 09:48 ? 00:00:00 nginx: worker process
0 S root 3062 2258 0 80 0 - 25827 pipe_w 10:52 pts/1 00:00:00 grep nginx
ACL
[root@my-repo]# getfacl nginx
# file: nginx
# owner: root
# group: root
user::rwx
group::rwx
other::rwx
[root@my-repo]# getfacl nginx/nginx-1.8.0-1.el6.ngx.x86_64.rpm
# file: nginx/nginx-1.8.0-1.el6.ngx.x86_64.rpm
# owner: root
# group: root
user::rwx
group::rwx
other::rwx
我不确定这里发生了什么问题,请有人帮助我解决这个问题
【问题讨论】:
-
错误消息表明对 my-repo 的 GET 请求失败。与文件权限无关。
-
GET 仅适用于该目录的其他目录;它不起作用,所以我很困惑为什么会这样
-
你检查过所有父目录的权限吗?
-
是的,我现在创建的所有父目录 777