且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

禁止所有文件使用 Nginx 403

更新时间:2023-11-19 20:07:58

一个经常被忽视的权限要求是用户需要在文件的每个父目录中拥有 x 权限才能访问该文件.检查/、/home、/home/demo 等的权限以获取 www-data x 访问权限.我的猜测是/home 可能是 770 并且 www-data 不能通过它来访问任何子目录.如果是,请尝试 chmod o+x/home(或任何拒绝请求的目录).

One permission requirement that is often overlooked is a user needs x permissions in every parent directory of a file to access that file. Check the permissions on /, /home, /home/demo, etc. for www-data x access. My guess is that /home is probably 770 and www-data can't chdir through it to get to any subdir. If it is, try chmod o+x /home (or whatever dir is denying the request).

要轻松显示路径上的所有权限,您可以使用 namei -om/path/to/check

To easily display all the permissions on a path, you can use namei -om /path/to/check