日期:2014-05-17  浏览次数:20968 次

Apache 设置虚拟目录和本地解析问题!!!
我设置本地的hosts 
127.0.0.1 localhost
127.0.0.1 test.com
127.0.0.1 xz.com


apache 的httpd-vhosts.conf
<VirtualHost *:80>
  ServerAdmin root@corin.cn
  DocumentRoot "D:/xampp/htdocs"
  ServerName null.corin.cn
<Directory "D:/xampp/htdocs">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
  ServerAdmin root@corin.cn
  DocumentRoot "D:\xingzuo"
  ServerName xz.com
<Directory "D:\xingzuo">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
  ServerAdmin root@corin.cn
  DocumentRoot "D:\xingzuo"
  ServerName xz.com
<Directory "D:\xzwang">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

重启apache后,无论输入:localhost还是xz.com还是test.com,都指向了我D:/xampp/htdocs目录;
而另一台机子 同样的设置 却可以访问不同目录!
为什么会这样呢?



------解决方案--------------------
探讨

确认你改的 vhosts 文件是生效的 vhosts 文件...