【问题标题】:wamp-apache cant acces folder after adding virtual hostswamp-apache 添加虚拟主机后无法访问文件夹
【发布时间】:2014-04-08 07:30:57
【问题描述】:
-
我在 c:\Windows\System32\drivers\etc\hosts 中添加了
127.0.0.1 mysite.com
-
在 httpd-vhosts.conf 中
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "c:/wamp/www/sf2/web/"
ServerName mysite.com
在 httpd.conf 中未注释“包括 conf/extra/httpd-vhosts.conf”
mysite.com 运行,但现在我无法访问 c:\wamp\www 中的旧文件夹
有没有办法解决
“localhost/somefolder”->打开“c:/wamp/www/somefolder”
“mysite.com”->打开“c:/wamp/www/sf2/web/”
同时?
【问题讨论】:
标签:
apache
virtualhost
wampserver
【解决方案1】:
当您添加虚拟主机时,您还必须为您的 localhost 环境创建一个。
在\wamp\www 文件夹结构之外创建虚拟主机也是一个好主意。我在这个例子中使用了C:\websrc\www。它确保每个站点的安全性不会与另一个站点混淆,并且如果您更改 wamp,您不会意外丢失您的站点代码。
所以在你的 httpd-vhosts.conf 中试试这个
Should be first vhost so the the wamp menu page loads
Also should keep the security as this PC and internal network only
<VirtualHost *:80>
ServerAdmin webmaster@mysite.net
DocumentRoot "C:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "C:/wamp/www">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1 192.168.0
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@mysite.net
DocumentRoot "C:/websrc/www/sf2/web"
ServerName mysite.com
ServerAlias www.mysite.com
Options Indexes FollowSymLinks
<Directory "D:/websrc/www/sf2/web">
AllowOverride All
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1 192.168.0
</Directory>
</VirtualHost>