错误apache:访问被拒绝

时间:2016-05-21 10:45:40

标签: apache wamp wampserver

我的配置:

Wampserver 3.0.0 32bits Apache 2.4.17 php 5.6.15 mysql 5.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>

我的主人档案:

  

我想我不太明白你的意思。我的内容   hosts文件是:   127.0.0.1 localhost   127.0.0.1 api.project.com   127.0.0.1 localhost.project.com

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

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

1 个答案:

答案 0 :(得分:0)

您正在使用带有虚拟主机的localhost, 如果这是您的主机文件,那么它是正确的

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

在您的本地浏览器中,您将编写其中一个网址。

但是您的虚拟主机配置必须响应特定主机而不是*,例如,您必须<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>