禁止的错误 - Apache

Forbidden Error - Apache

我已经编辑了我的 httpd.conf,但我仍然收到错误:

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

我正在努力让所有人都能访问我的 WAMP 网站。我将其添加到我的 httpd.conf 文件中:

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

重新启动我的 WAMP 服务器后,当我无法从我的本地计算机访问我的网站时,我仍然收到错误消息。

我正在使用具有 Apache 2.4.9 的 WAMPServer 2.5。

将 DirectoryRoot 更改为 <Directory c:/wamp/www> 确保 C:\wamp\www

的所有权和权限
User: yourusername
Permission: Allow  - Read and execute and Read permissions

你应该试试这个:

编辑C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf(apache2.4.9可能不同,取决于你的apache版本)

一直向下滚动直到找到 Deny from all 并更改它 Allow from all

编辑 对@Bonner 的回答

Your permissions are still wrong

如果他们仍然错了,请提供正确的许可,而不是仅仅指出来。基于 "my poor knowledge" 我认为许可是可以的。

you have failed to ask whether the WAMP tray icon is appearing or not

基于问题描述

After restarting my WAMP server,

我假设出现了 WAMP 托盘。

If you make changes to the httpd-vhosts.conf they will be overwritten by the tray icon software when an option is changed

错误。 WAMP 控制面板 让您可以编辑 my.inihttpd.confphp.ini 等配置文件。但是,您无法编辑 httpd-vhosts.conf 来自 WAMP 控制面板

您更改的 httpd.conf 部分保护安装 Apache 的驱动器,应设置为

<Directory />
    AllowOverride none
    Require all denied
</Directory>

现在你要找的httpd.conf段就是这个

它以

开头
<Directory "c:/wamp/www/">

在那个部分里面有这样一行

#   onlineoffline tag - don't remove
Require local

要允许从任何 IP 地址访问,请将其更改为此

#   onlineoffline tag - don't remove
Require all granted

您应该可以像这样使用 wampmanager 菜单来执行此操作:

wampmanager -> Put Online

然而,如果您更改了 # onlineoffline tag - don't remove 行周围的代码部分,使用菜单完成的自动编辑可能无法工作,因此手动进行可能更容易,或者至少检查菜单控制的编辑工作正常。