gpt4 book ai didi

Apache - 您无权访问/在此服务器上

转载 作者:行者123 更新时间:2023-12-01 00:35:40 27 4
gpt4 key购买 nike

clg.localhost/我收到错误:

You don't have permission to access / on this server.



但是,关注 this ,我已经设置了我的 Apache httpd.confsites.conf允许访问 AllowOverride allRequire all granted .我还缺少什么?

版本:
$ /usr/sbin/httpd -v
Server version: Apache/2.4.23 (Unix)
Server built: Aug 8 2016 18:10:45

Apache httpd.conf:
DocumentRoot "/Users/danniu/Sites"
<Directory "/Users/danniu/Sites">
#
# 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 FollowSymLinks Multiviews
MultiviewsMatch Any

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

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

...

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride all
Require all granted
</Directory>

Apache 站点.conf:
# Workaround for missing Authorization header under CGI/FastCGI Apache:
<IfModule setenvif_module>
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
</IfModule>

# Serve ~/Sites at http://localhost
ServerName localhost

<VirtualHost *:80>
ServerName clg.localhost
DocumentRoot /Users/danniu/Sites/CLG/CLG-dev
</VirtualHost>

我想也许 httpd.conf没有被正确拾取,所以我直接在虚拟主机中指定了根,同样的问题。
<VirtualHost *:80>
ServerName clg.localhost
DocumentRoot /Users/danniu/Sites/CLG/CLG-dev
# Set access permission
<Directory "/Users/danniu/Sites/CLG/CLG-dev">
Require all granted
</Directory>
</VirtualHost>

最佳答案

/是一个目录,因此如果您没有使用 DirectoryIndex 指向的索引文件,例如 index.html,并且您没有启用索引,因为您没有启用,Apache 无法显示您的文档根目录的内容.

请注意您有 Options FollowSymLinks Multiviews
解决方案是,在选项中为“目录列表”添加如下索引(这取决于之前加载的 mod_autoindex):

Options FollowSymLinks Multiviews Indexes

如果你想加载一个默认文件,例如 index.html,DirectoryIndex 默认查找 index.html,所以添加它,或者如果它在其他地方覆盖它的行为:
DirectoryIndex index.html 

关于Apache - 您无权访问/在此服务器上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41392022/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com