添加VirtualHost失败:访问禁止的错误403(XAMPP)(Windows 7)

我有一个在Windows 7上运行的XAMPP安装。

只要我将虚拟主机添加到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> 

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

我的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> – 内部的<VirtualHost > [..] </VirtualHost> 。 之后,我添加了AllowOverride AuthConfig Indexes<Directory>选项。

现在http://localhost也指向dropbox-virtualhost。 所以我添加了dropbox.local<VirtualHost *:80> ,它使<VirtualHost dropbox.local:80>

最后它的作品:D!

我是一个快乐的人! 🙂 🙂

我希望别人可以使用这个信息。

对于我改变“目录”内容的工作:

 <Directory "*YourLocation*"> Options All AllowOverride All Require all granted </Directory> 

对我来说(也是在Windows 7上的XAMPP),这是什么工作:

 <Directory "C:\projects\myfolder\htdocs">` AllowOverride All Require all granted Options Indexes FollowSymLinks </Directory>` 

正是这条线会导致403:

 Order allow,deny 

我在Windows 7上使用XAMPP 1.6.7。 这篇文章为我工作。

我在C:/xampp/apache/conf/extra文件httpd-vhosts.conf中添加了以下行。
我也取消了注释行# NameVirtualHost *:80

 <VirtualHost mysite.dev:80> DocumentRoot "C:/xampp/htdocs/mysite" ServerName mysite.dev ServerAlias mysite.dev <Directory "C:/xampp/htdocs/mysite"> Order allow,deny Allow from all </Directory> </VirtualHost> 

重新启动Apache后,它仍然无法正常工作。 然后我必须通过编辑文件C:/Windows/System32/drivers/etc/hosts来执行本文中提到的步骤9。

 # localhost name resolution is handled within DNS itself. 127.0.0.1 localhost ::1 localhost 127.0.0.1 mysite.dev 

然后我开始工作http://mysite.dev

谢谢你,工作! 但是我取代了这个

 AllowOverride AuthConfig Indexes 

接着就,随即

 AllowOverride All 

否则,.htaccess不起作用:我遇到了RewriteEngine问题和错误信息“RewriteEngine not permitted here”。

以上build议没有为我工作。 我把它运行在我的窗户上,使用http://butlerccwebdev.net/support/testingserver/vhosts-setup-win.html

对于httpd-vhosts.conf中的http

 <Directory "D:/Projects"> AllowOverride All Require all granted </Directory> ##Letzgrow <VirtualHost *:80> DocumentRoot "D:/Projects/letzgrow" ServerName letz.dev ServerAlias letz.dev </VirtualHost> 

在httpd-ssl.conf中使用Https(Open SSL)

 <Directory "D:/Projects"> AllowOverride All Require all granted </Directory> ##Letzgrow <VirtualHost *:443> DocumentRoot "D:/Projects/letzgrow" ServerName letz.dev ServerAlias letz.dev </VirtualHost> 

希望它可以帮助别人!

我正在使用xampp 1.7.3。 从这里使用灵感: xampp 1.7.3升级破损的虚拟主机访问被禁止

httpd-vhosts.conf中添加<Directory> .. </Directory> ,我将它添加到httpd.conf中的 <Directory "D:/xampplite/cgi-bin"> .. </Directory>

这是我在httpd.conf中添加的内容:

 <Directory "D:/CofeeShop"> AllowOverride All Options All Order allow,deny Allow from all </Directory> 

这里是我在httpd-vhosts.conf中添加的内容

 <VirtualHost *:8001> ServerAdmin postmaster@dummy-host2.localhost DocumentRoot "D:/CofeeShop" ServerName localhost:8001 </VirtualHost> 

我还在httpd.conf中添加Listen 8001来完成我的设置。

希望能帮助到你

对于很多人来说,这是一个许可问题,但对我来说,这个错误是由我想提交的一个错误造成的。 具体来说,我不小心把一个“大于”的标志后面的“行动”的价值。 所以我build议你再看看你的代码。