XAMPP虚拟主机配置,实现单主机多个站点

打开注释 NameVirtualHost *:80

 

添加以下内容:

<virtualhost *:80>
documentroot "D:\zq\myself\01"
servername book
##   errorlog @rel_logfiledir@/dummy-host2.example.com-error_log
##   customlog @rel_logfiledir@/dummy-host2.example.com-access_log common
</virtualhost>
<virtualhost *:80>
documentroot "D:\zq\thinkphp\Examples"
servername demo
##   errorlog @rel_logfiledir@/dummy-host2.example.com-error_log
##   customlog @rel_logfiledir@/dummy-host2.example.com-access_log common
</virtualhost>


<directory "D:\zq\myself\01">
Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</directory>
<directory "D:\zq\thinkphp\Examples">
Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</directory>

 

修改后,保存httpd-vhosts.conf文件,重启Apache。

第二步:编辑此文件:

C:\WINDOWS\system32\drivers\etc\hosts

在后面添加:

127.0.0.1  book

127.0.0.1  demo

然后保存。然后通过访问 http://book即可访问新虚拟站点了。

posted on 2010-09-02 23:24  haven24  阅读(2004)  评论(0编辑  收藏  举报

导航