0

在通过 WAMPserver 安装 Apache 时,http.conf设置为

<Directory "c:/WAMP/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

hosts文件设置为

127.0.0.1       awesomedudes
127.0.0.1       localhost

但是,只有http://awesomedudes正确c:/WAMP/wwwhttp://localhost而是返回以下内容:

403 Forbidden

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

有任何想法吗?

4

1 回答 1

1

Fixed it! The WAMP Server is running on Windows 8, which uses IPv6 by default. When specifying hostnames via hosts, IPv4 is used and connects to 127.0.0.1 correctly. However, Windows 8 resolves localhost via IPv6, which Apache then sees as coming in from the IPv6 localhost at ::1.

Adding the following to httpd.conf resolved the issue (The extra line before Allow from ::1 is there to keep the line from being rewritten by WAMPserver's "Put Online" function):

Order Deny,Allow
Deny from all
Allow from 127.0.0.1

Allow from ::1
于 2013-06-09T17:07:47.757 回答