错误 apache:访问被拒绝

Error apache : access denied

我的配置:

Wampserver 3.0.0 32 位 阿帕奇 2.4.17 php 5.6.15 mysql5.7.9

我的问题: WampServer 正常启动,但是当我尝试访问日志中的项目时,我有:


[Sat May 21 10:55:39.393866 2016] [authz_core:error] [pid 6984:tid 1140] [client 127.0.0.1:50070] AH01630: client denied by server configuration: C:/wamp/www/project/api/app/

[Sat May 21 10:55:39.395878 2016] [authz_core:error] [pid 6984:tid 1140] [client 127.0.0.1:50070] AH01630: client denied by server configuration: C:/wamp/www/project/api/src/

但是我检查了我的配置文件,一切似乎都正常。

有我的配置文件:

httpd.conf :

<Directory "C:/wamp/www/">
#
# 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
# [httpd.apache.org]
# 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:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all

#
# Controls who can get stuff from this server.
#

#onlineoffline tag - don't remove
#Require local
Require all granted
</Directory>


httpd-vhosts.conf:

<VirtualHost *:80>
ServerAdmin admin@test.fr
ServerName localhost
DocumentRoot "C:/wamp/www"
<Directory "C:/wamp/www">
Options +Indexes +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerAdmin admin@test.fr
ServerName localhost.project.com
#ServerAlias localhost.project.com
DocumentRoot "C:/wamp/www/project/website/web/"
<Directory "C:/wamp/www/project/website/web/">
Options +Indexes +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerAdmin admin@test.fr
DocumentRoot "C:/wamp/www/project/api"
ServerName api.project.com
#ServerAlias api.project.com
<Directory "C:/wamp/www/project/api">
Options +Indexes +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerAdmin admin@test.fr
DocumentRoot "C:/wamp/www/Demo_websocket/web"
ServerName demo.websocket
#ServerAlias demo.websocket
<Directory "C:/wamp/www/Demo_websocket/web">
Options +Indexes +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>

我的主机文件:

I think I do not understand very well what you mean. The content of my hosts file is : 127.0.0.1 localhost 127.0.0.1 api.project.com 127.0.0.1 localhost.project.com

我已经尝试在 VirtualHost 中设置 Require all granted 但没有成功 :s

如果有人已经遇到过这个问题并找到了解决方案,我很感兴趣。谢谢

您正在使用带有虚拟主机的本地主机, 如果这是你的主机文件,它是正确的

127.0.0.1 localhost 
127.0.0.1 api.project.com 
127.0.0.1 localhost.project.com

然后在您的本地浏览器中编写这些 URL 之一。

但是您的虚拟主机配置必须响应特定主机而不是*,例如 fo api 您必须有 <VirtualHost api.project.com:80> 而不是 <VirtualHost *:80>

通用 * 虚拟主机也必须在列表的末尾,那么结果是:

<VirtualHost localhost.project.com:80>
ServerAdmin admin@test.fr
ServerName localhost.project.com
#ServerAlias localhost.project.com
DocumentRoot "C:/wamp/www/project/website/web/"
<Directory "C:/wamp/www/project/website/web/">
Options +Indexes +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>

<VirtualHost api.project.com:80>
ServerAdmin admin@test.fr
DocumentRoot "C:/wamp/www/project/api"
ServerName api.project.com
#ServerAlias api.project.com
<Directory "C:/wamp/www/project/api">
Options +Indexes +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>

<VirtualHost demo.websocket:80>
ServerAdmin admin@test.fr
DocumentRoot "C:/wamp/www/Demo_websocket/web"
ServerName demo.websocket
#ServerAlias demo.websocket
<Directory "C:/wamp/www/Demo_websocket/web">
Options +Indexes +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerAdmin admin@test.fr
ServerName localhost
DocumentRoot "C:/wamp/www"
<Directory "C:/wamp/www">
Options +Indexes +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>