ILD

fedora httpd directory 403 Forbidden
作者:Yuan Jianpeng 邮箱:yuanjp89@163.com
发布时间:2023-12-9 站点:Inside Linux Development

fedora 35需要搭建一个文件http服务器,


安装:

$ sudo dnf install httpd

实际上是一个apache服务器


配置文件:/etc/httpd/conf/httpd.conf


修改用户和主目录:

User yuanjianpeng

Group yuanjianpeng


DocumentRoot "/work/tftproot"


<Directory "/work/tftproot">

    Options ALL

    AllowOverride None

    # Allow open access:

    Require all granted

</Directory>


重启:

$ sudo systemctl restart httpd


访问 http://127.0.0.1

Forbidden

You don't have permission to access this resource.


查看日志:/etc/httpd/logs/

[Sat Dec 09 14:06:19.782353 2023] [autoindex:error] [pid 75614:tid 75759] (13)Permission denied: [client 127.0.0.1:47620] AH01275: Can't open directory for index: /a/b/

[Sat Dec 09 14:06:25.093012 2023] [core:error] [pid 75611:tid 75661] (13)Permission denied: [client 127.0.0.1:47628] AH00035: access to /123 denied (filesystem path '/a/b/123') because search permissions are missing on a component of the path


研究了半天,以为是文件系统权限的问题,加了权限还是不好使,原来是selinux搞的鬼,关掉就好了:

$ setenforce 0


参考:

https://serverfault.com/questions/1041060/solving-apache-search-permissions-are-missing-on-a-component-of-the-path-issue


Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.