添加 VirtualHost 失败:访问禁止错误 403 (XAMPP) (Windows 7) [英] Adding VirtualHost fails: Access Forbidden Error 403 (XAMPP) (Windows 7)
问题描述
我在 Windows 7 上安装了 XAMPP.
一旦我将 VirtualHost 添加到 httpd-vhosts.conf,常规"http://localhost
和新的 dropbox.local
都不是工作.
这是我添加到我的 httpd-vhosts.conf
中的内容:
ServerAdmin postmaster@dummy-host.localhostDocumentRoot "E:/Documenten/Dropbox/Dropbox/dummy-htdocs"服务器名称 dropbox.localServerAlias www.dropbox.local错误日志日志/dropbox.local-error.log"CustomLog "logs/dropbox.local-access.log" 组合</虚拟主机>
所以我查找了我的 dropbox.local-error.log
以获取任何信息:
[Thu Feb 02 10:41:57 2012] [error] [client 127.0.0.1] 客户端被服务器配置拒绝:E:/Documenten/Dropbox/Dropbox/dummy-htdocs/
这个错误似乎通过添加
来解决<目录E:/Documenten/Dropbox/Dropbox/dummy-htdocs">所有人都允许</目录>
但现在我在 dropbox.local-error.log
中收到此错误:
[Thu Feb 02 10:45:56 2012] [error] [client ::1] 选项指令禁止的目录索引:E:/Documenten/Dropbox/Dropbox/dummy-htdocs/
此外,当我尝试访问 http://localhost
时,我在常规 error.log
中没有收到任何错误,尽管我收到了 error 403
当我尝试访问它时.
任何人都可以帮忙......这让我很生气:S
同样在 httpd.conf
中有以下内容(我已经多次看到它提到过,所以在任何人说之前):
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>
好的:这就是我现在所做的并且已经解决了:
我的 httpd-vhosts.conf
现在看起来像这样:
DocumentRoot "E:/Documenten/Dropbox/Dropbox/dummy-htdocs"服务器名称 dropbox.local错误日志日志/dropbox.local-error.log"CustomLog "logs/dropbox.local-access.log" 组合<目录E:/Documenten/Dropbox/Dropbox/dummy-htdocs"># AllowOverride All # 已弃用# 订单允许,拒绝 # 已弃用# 允许所有 # 已弃用# -- 新的方法要求所有授予</目录></虚拟主机>
首先,我看到有必要设置
选项.所以我把 <Directory >[..] </Directory>
-part INSIDE AllowOverride AuthConfig Indexes
添加到
选项.
现在 http://localhost
也指向 dropbox-virtualhost.所以我将 dropbox.local
添加到
使其成为
>
终于成功了:D!
我是一个快乐的人!:) :)
我希望其他人可以使用这些信息.
I've got a XAMPP installation running on Windows 7.
As soon as I add a VirtualHost to httpd-vhosts.conf, BOTH the 'regular' http://localhost
AND the new dropbox.local
aren't working.
This is what I added to my 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>
So I looked up my dropbox.local-error.log
for any information:
[Thu Feb 02 10:41:57 2012] [error] [client 127.0.0.1] client denied by server configuration: E:/Documenten/Dropbox/Dropbox/dummy-htdocs/
This error seems to be solved by adding
<directory "E:/Documenten/Dropbox/Dropbox/dummy-htdocs">
Allow from all
</directory>
But now I get this error in 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/
Furthermore when I try to access http://localhost
, I dont get any error in the regular error.log
, although I get the error 403
when I try to access it.
Can anybody help... It's driving me mad :S
EDIT:
Also in httpd.conf
there is the following (I've seen it mentioned multiple times, so before anyone says it):
<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>
Okay: This is what I did now and it's solved:
My httpd-vhosts.conf
looks like this now:
<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>
First, I saw that it's necessary to have set the <Directory xx:xx>
options. So I put the <Directory > [..] </Directory>
-part INSIDE the <VirtualHost > [..] </VirtualHost>
.
After that, I added AllowOverride AuthConfig Indexes
to the <Directory>
options.
Now http://localhost
also points to the dropbox-virtualhost. So I added dropbox.local
to <VirtualHost *:80>
which makes it as <VirtualHost dropbox.local:80>
FINALLY it works :D!
I'm a happy man! :) :)
I hope someone else can use this information.
这篇关于添加 VirtualHost 失败:访问禁止错误 403 (XAMPP) (Windows 7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!