如何用wampserver实现一台主机配置多个域名对应不同的站点(单IP多域名多站点功能)?
1、开启虚拟主机
在""文件中查找:Includeconf/extra/,去掉前面的注释下面为目录权限配置信息,可以省略
Directory"D:/wamp/www/zl266"
OptionsIndexesFollowSymLinks
AllowOverrideNone
Orderallow,deny
Allowfromall
/Directory
/VirtualHost
VirtualHost*:80
DocumentRoot"D:/wamp/www/mifans"
ServerAlias*.
/VirtualHost
3、在C:\WINDOWS\system32\drivers\etc\hosts文件中添加如下记录,使域名能够指向主机。
127.0.0.1(你自己的域名)
127.0.0.1(你自己的域名)
4、把所以网站空间的目录记录写进Apache
编辑wamp\Apache2\conf\,找到DocumentRoot"d:/wamp/www/"这项,这是默认根目录路径,但是要更改的不是这个,一直往下找,找到Directory"D:/wamp/www",然后找到对应字段,在下面加上:
Directory"D:/wamp/www/zl266"
OptionsIndexesFollowSymLinks
AllowOverrideall
OrderAllow,Deny
Allowfromall
/Directory
Directory"D:/wamp/www/mifans"
OptionsIndexesFollowSymLinks
AllowOverrideall
OrderAllow,Deny
Allowfromall
/Directory
这里的"D:/wamp/www/zl266"和"D:/wamp/www/mifans"为前面VirtualHost里的路径。保存和,然后重启Apache。完成以上步骤,就可以做到
访问打开的是D:/wamp/www/zl266目录下的网站,
访问打开的是D:/wamp/www/mifans目录下的网站,
从而实现了单IP多域名多站点的功能。


