一、通过端口来区分不同的虚拟主机 (站点)
1)指定项目所在位置,例:d:/test1 d:/test2
2)php中配置conf下面的httpd.conf文件,启用extra目录下的httpd-vhosts.conf
# Virtual hosts
Include conf/extra
tpd-vhosts.conf
Include conf/extra
3)配置我们的httpd-vhosts.conf,注销httpd.conf中的DocumentRoot
<VirtualHost 127.0.0.1:80>
DocumentRoot "d:/test1"
DirectoryIndex test.html index.html index.htm index.php <-- test.html为自己想要的首页-->
<Directory/>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost 127.0.0.1:81>
DocumentRoot "d:/test2"
DirectoryIndex test.html index.html index.htm index.php <-- test.html为自己想要的首页-->
<Directory/>
Options FollowSymLinks
AllowOv