PHP学习笔记-Wampserver多站点配置

1、找到D:\wamp64\bin\apache\apache2.4.18\conf\original\extra目录下的httpd-vhosts.conf文件(虚拟目录的配置文件)。里面已经给了两个实例,我们复制两个

<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com 设置管理员的邮箱地址
DocumentRoot "c:/Apache24/docs/dummy-host2.example.com" 文件目录,就是你网站的代码所在的目录
ServerName dummy-host2.example.com 主机名
ErrorLog "logs/dummy-host2.example.com-error.log" 错误日志
CustomLog "logs/dummy-host2.example.com-access.log" common 日常日志

</VirtualHost>

目前我们只需要第二个和第三个,把不需要的删掉

<VirtualHost *:80>

DocumentRoot "I:/demo/test01"
ServerName test01.com

</VirtualHost>
这样网站就配置好了。
2、httpd-vhosts.conf文件默认是不加载的,我们要让apache加载需要在httpd.conf中修改。我们找到第511行的# Virtual hosts在下面添加

   Include conf/original/extra/httpd-vhosts.conf代码加载了httpd-vhosts.conf文件。
3、关于apache默认拒绝其他外部主机地址资源访问服务器下的资源(我的这款软件版本已经不存在这个问题Wamppserver3.0.4_x64_apache2.4.18_mysql5.7.11_php5.6.19-7.0.4)
4、然后我们要在demo文件下建立网站test01文件夹,在里面写一个网站代码,建立网站test02文件夹,在里面写一个网站代码.
5、最后在C:\Windows\System32\drivers\etc文件下找到hosts文件加入站点127.0.0.1 test01.com和127.0.0.1 test02.com

posted @ 2016-08-10 13:11  李博华A  阅读(96)  评论(0)    收藏  举报