|  | 
 
| Apache,版本2.2.8,安装完成后,进行相关测试; 配置了下php的php.in文件,再次localhost打开发现错误:
 HTTP 错误 403 - 禁止访问,即403 Forbidden:You don't have permission to access / on this server.
 可能是权限不足引起的问题。
 解决方法:
 
 打开apa?che的配置文件httpd.conf,逐行检查。
 找到:
 代码示例:
 <Directory />
 Options FollowSymLinks
 AllowOverride None
 Order deny,allow
 Deny from all
 </Directory>
 由于配置了php后,此处“Deny from all”为拒绝一切连接。
 把此行修改为 “Allow from all”,即可解决问题。
 修改后的代码为:
 代码示例:
 <Directory />
 Options FollowSymLinks
 AllowOverride None
 Order deny,allow
 allow from all
 </Directory>
 浏览器里打开http://localhost,显示it works!问题解决。
 总结:
 在apache服务器中,遇到403禁止访问时,重点关注下apache的httpd.conf配置文件中,是否有“Deny from all”这样的代码。
 这个可能是修改了某些配置文件后,重启apache,被自动更改的。
 附,另外一个apache 403错误的例子。
 apache 403错误,显示信息如下:
 您无权查看该网页
 您可能没有权限用您提供的凭据查看此目录或网页
 如果您确信能够查看该目录或网页,请尝试使用 192.168.1.5 主页上所列的电子邮件地址或电话与网站联系。
 可以单击搜索,寻找 Internet 上的信息。
 HTTP 错误 403 - 禁止访问
 Internet Explorer
 去掉显示友好信息的钩后显示Forbidden   You don't have permission to access on this server.
 检查了一遍配置文件httpd.conf,找到这么一段:
 代码示例:
 <Directory />
 Options FollowSymLinks
 AllowOverride None
 Order deny,allow
 deny from all
 Satisfy all
 </Directory>
 然后试着把deny from all中的deny改成了allow,保存后重起了apache,访问测试网站完全正常了。
 APACHE升级到2.2版本之后,提供和支持不少模块的支持,性能和安全上也有不少改进。
 以前配置好apache的httpd.conf之后,即可使用。
 但现在必须额外对这个文件进行其他方面的配置,不然会出现 http 403权限问题错误。
 解决方法。
 以下为httpd.conf文件的其中一段原代码。
 把下面代码红色标志进行更改:
 代码示例:
 <Directory "E:/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
 # http://httpd.apache.org/docs/2.2/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 all
 #
 # Controls who can get stuff from this server.
 #
 #   onlineoffline tag - don't remove
 Order Deny,Allow
 Deny from all
 Allow from 127.0.0.1
 </Directory>
 红色部分更改为 Allow from all ,也就是所有访问允许通过。
 | 
 |