如何在Fedora 31上更改Apache 2.4.41的文档根目录,而又不获取403禁止页面?

时间:2019-11-23 14:14:58

标签: apache fedora

我想将文档根目录从默认的“ / var / www / html”更改为“ / home / user / Documents / htdocs”,但始终获得403 Forbidden页面。这只是一台测试计算机。

我对/etc/httpd/conf/httpd.conf进行了更改:

DocumentRoot "/home/user/Documents/htdocs"

#
# Relax access to content within /var/www.
#
<Directory "/home/user/Documents/htdocs">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

# Further relax access to the default document root:
<Directory "/home/user/Documents/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride none

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

我已经设置了对目录的权限,

chmod 775 /home/user/Documents/htdocs

我已更改所有权,

chown -Rv user:user /home/user/Documents/htdocs

我还通过以下方式更改了selinux设置:

setenforce 0
sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config

但是仍然无法正确显示..仍然无法正确看到我的本地主机。

0 个答案:

没有答案