您的位置:首页 > 其它

wamp5虚拟主机的配置

2017-05-27 10:46 253 查看
1  编辑httpd.conf,查找Include conf/extra/httpd-vhosts.conf,把前面注释符号“#”删掉。

2  编辑httpd-vhosts.conf,我把WAMPServer安装在D:/wamp,所以我这里的路径是D:\wamp\Apache2\conf\extra。 

把里面的内容清空掉,换成下面的内容:

NameVirtualHost *:80

<VirtualHost *:80>

ServerName www.host1.com

ServerAlias www.host1.com

DocumentRoot "D:/wamp/www/host1"

</VirtualHost>

<VirtualHost *:80>

ServerName www.host2.com

ServerAlias www.host2.com

DocumentRoot "D:/wamp/www/host2"

</VirtualHost>

3 编辑httpd.conf,找到DocumentRoot "d:/wamp/www/"这项,这是默认根目录路径,但是要更改的不是这个,一直往下找,找到<Directory "d:/wamp/www">,然后在该</Directoory>后加上如下内容:

<Directory "d:/wamp/www/host1">

Options Indexes FollowSymLinks

AllowOverride all

Order Allow,Deny

Allow from all

</Directory>

<Directory "d:/wamp/www/host2">

Options Indexes FollowSymLinks

AllowOverride all

Order Allow,Deny

Allow from all

</Directory>

4  修改C:/WINDOWS/system3/drivers/etc/host这个文件,用记事本打开,加上如下内容:

127.0.0.1  www.host1.com

127.0.0.1  www.host2.com

好了,然后重启apache,在浏览器里面输入www.host1.com,看看访问到的内容是不是host1这个目录呢。

 

 

丸子:

<VirtualHost *:80>

DocumentRoot D:/wamp/www/test

ServerName www.test.com

</VirtualHost>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: