如何解决添加 VirtualHost 失败:访问禁止错误 403 (XAMPP) (Windows 7)?

好的:这就是我现在所做的,它已经解决了:

httpd-vhosts.conf现在的样子是这样的:

<VirtualHost dropBox.local:80>
    DocumentRoot "E:/Documenten/DropBox/DropBox/dummy-htdocs"
    ServerName dropBox.local
    ErrorLog "logs/dropBox.local-error.log"
    CustomLog "logs/dropBox.local-access.log" combined
    <Directory "E:/Documenten/DropBox/DropBox/dummy-htdocs">
        # AllowOverride All      # Deprecated
        # Order Allow,Deny       # Deprecated
        # Allow from all         # Deprecated

        # --New way of doing it
        Require all granted    
    </Directory>
</VirtualHost>

首先,我看到有必要设置<Directory xx:xx>选项。所以我把<Directory > [..]
</Directory>
-part放在<VirtualHost > [..] </VirtualHost>. 之后,我添加AllowOverride
AuthConfig Indexes
<Directory>选项。

现在http://localhost还指向 dropBox-virtualhost。所以我添加dropBox.local<VirtualHost
*:80>
which 使它成为<VirtualHost dropBox.local:80>

最后它起作用了:D!

我是一个快乐的人!:) :)

我希望其他人可以使用此信息。

解决方法

我在 Windows 7 上运行了 XAMPP 安装。

一旦我将 VirtualHost 添加到 httpd-vhosts.conf,’常规’http://localhost和新dropbox.local
的都不起作用。

这是我添加到我的httpd-vhosts.conf

<VirtualHost *:80>
    ServerAdmin postmaster@dummy-host.localhost
    DocumentRoot "E:/Documenten/Dropbox/Dropbox/dummy-htdocs"
    ServerName dropbox.local
    ServerAlias www.dropbox.local
    ErrorLog "logs/dropbox.local-error.log"
    CustomLog "logs/dropbox.local-access.log" combined
</VirtualHost>

所以我查找了我dropbox.local-error.log的任何信息:

[Thu Feb 02 10:41:57 2012] [error] [client 127.0.0.1] client denied by server configuration: E:/Documenten/Dropbox/Dropbox/dummy-htdocs/

这个错误似乎可以通过添加来解决

<directory "E:/Documenten/Dropbox/Dropbox/dummy-htdocs">
     Allow from all
</directory>

但现在我得到这个错误dropbox.local-error.log

[Thu Feb 02 10:45:56 2012] [error] [client ::1] Directory index forbidden by Options directive: E:/Documenten/Dropbox/Dropbox/dummy-htdocs/

此外,当我尝试访问时,虽然我在尝试访问它时得到了,但我http://localhost在常规中没有收到任何错误。error.log``error
403

任何人都可以帮忙......这让我发疯:S

编辑:还有httpd.conf以下内容(我已经多次看到它被提及,所以在任何人说之前):

<IfModule dir_module>
    DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \
                   default.php default.pl default.cgi default.asp default.shtml default.html default.htm \
                   home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>