dd

apache出错:Forbidden You don't have permission to access / on this server.

jerry PHP 2015年08月28日 收藏

今天在apache下测试一个php程序的时候,发现这个问题:

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

修改一下php的配置文件httpd.conf。
在原有的位置文件中找到配置节

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

修改成

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</Directory>

把Deny from all改为Allow from all就可了。

但是在apache2.4下问题依旧出现,解决办法如下,添加

Require all granted

再次修改httpd.conf

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
    Require all granted
</Directory>

下面是我的配置:

#############################################################
# 
# @author        liushengxu
# @date          2015-01-01
# @description   This virtual host is use to demo
# 
#############################################################
NameVirtualHost *:80
<VirtualHost *:80>
    DocumentRoot "D:/phpxm/mbsucai"
    ServerName www.jianzhan.love
    ServerAlias www.jianzhan.love jianzhan.love
    <Directory "D:/phpxm/mbsucai">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
    </Directory>
    ErrorLog "D:/phpxm/mbsucai/error.log"
    CustomLog "D:/phpxm/mbsucai/access.log" combined
</VirtualHost>
dd