我在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/
此外,当我尝试访问qazxsw poi时,我没有在常规qazxsw poi中出现任何错误,尽管当我尝试访问它时我得到了http://localhost
。
任何人都可以帮忙......这让我很生气:S
编辑:也在error.log
有以下(我已经多次提到它,所以在任何人说之前):
error 403
好的:这就是我现在所做的,它已经解决了:
我的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>
-part INSIDE放在了<Directory xx:xx>
。之后,我将<Directory > [..] </Directory>
添加到<VirtualHost > [..] </VirtualHost>
选项中。
现在,AllowOverride AuthConfig Indexes
也指向了dropbox-virtualhost。所以我把<Directory>
添加到http://localhost
,这使它成为dropbox.local
最终它有效:D!
我是个快乐的人! :) :)
我希望其他人可以使用这些信息。
对我来说,当我将“目录”内容更改为:
<VirtualHost *:80>
对我来说(在Windows 7上也是XAMPP),这是有用的:
<VirtualHost dropbox.local:80>
这条线会导致403:
<Directory "*YourLocation*">
Options All
AllowOverride All
Require all granted
</Directory>
我在Windows 7上使用XAMPP 1.6.7.<Directory "C:\projects\myfolder\htdocs">`
AllowOverride All
Require all granted
Options Indexes FollowSymLinks
</Directory>`
为我工作。
我在Order allow,deny
的This article文件中添加了以下几行。
我也没有注释线httpd-vhosts.conf
C:/xampp/apache/conf/extra
重新启动apache之后,它仍然无法正常工作。然后我必须通过编辑文件# NameVirtualHost *:80
来遵循文章中提到的步骤9。
<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>
然后我开始工作C:/Windows/System32/drivers/etc/hosts
谢谢,这很有效!但我取代了这个
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
::1 localhost
127.0.0.1 mysite.dev
接着就,随即
http://mysite.dev
否则,.htaccess不起作用:我遇到了RewriteEngine的问题,并出现错误消息“RewriteEngine not allowed here”。
以上建议对我没有用。我使用AllowOverride AuthConfig Indexes
的灵感在窗户上运行它
对于httpd-vhosts.conf中的Http
AllowOverride All
在httpd-ssl.conf中使用Https(Open SSL)
http://butlerccwebdev.net/support/testingserver/vhosts-setup-win.html
希望它可以帮助别人!!
经过这么多的改变和尝试和答案。对于
酱:Oindos 7 / Oindos 10
Xampp版本:Xampp或Xampp portable 7.1.18 / 7.3.7(控制面板v3.2.4)
安装人员:win32-7.1.18-0-VC14-installer / xampp-windows-x64-7.3.7-0-VC15-installer
<Directory "D:/Projects">
AllowOverride All
Require all granted
</Directory>
##Letzgrow
<VirtualHost *:80>
DocumentRoot "D:/Projects/letzgrow"
ServerName letz.dev
ServerAlias letz.dev
</VirtualHost>
的httpd-vhosts.conf(默认情况下您的XAMPP目录可能是:<Directory "D:/Projects">
AllowOverride All
Require all granted
</Directory>
##Letzgrow
<VirtualHost *:443>
DocumentRoot "D:/Projects/letzgrow"
ServerName letz.dev
ServerAlias letz.dev
</VirtualHost>
)**your_xampp_directory**\apache\conf\extra\
(这可能是可选的)C:/xampp/htdocs
NameVirtualHost *:80
,但有以下提示,每个域只有一个环回ip:
##127.0.0.1
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
##127.0.0.2
<VirtualHost *:80>
DocumentRoot "F:/myapp/htdocs/"
ServerName test1.localhost
ServerAlias www.test1.localhost
ErrorLog "logs/myapp-error.log"
CustomLog "logs/myapp-access.log" common
<Directory "F:/myapp/htdocs/">
#Options All # Deprecated
#AllowOverride All # Deprecated
Require all granted
</Directory>
</VirtualHost>
对于每个实例,重复第二个块,第一个块是仅用于“默认”目的的主块。
我正在使用xampp 1.7.3。从这里获取灵感:Windows\System32\drivers\etc
INSTEAD OF在httpd-vhosts.conf中添加127.0.0.1 localhost
127.0.0.2 test1.localhost
127.0.0.2 www.test1.localhost
,我在xampp 1.7.3 upgrade broken virtual hosts access forbidden之后立即将它添加到httpd.conf中。
这是我在httpd.conf中添加的内容:
<Directory> .. </Directory>
这是我在httpd-vhosts.conf中添加的内容
<Directory "D:/xampplite/cgi-bin"> .. </Directory>
我还在httpd.conf中添加了<Directory "D:/CofeeShop">
AllowOverride All
Options All
Order allow,deny
Allow from all
</Directory>
来完成我的设置。
希望能帮助到你
对于许多人来说这是一个许可问题,但对我来说,事实证明错误是由我试图提交的形式中的错误引起的。具体来说,我在“行动”的价值后意外地放了一个“大于”的标志。所以我建议你再看看你的代码。