apache域名绑定

方法1:

D:\wamp\bin\apache\Apache2.2.17\conf\httpd.conf文件下

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>


下添加如下

NameVirtualHost *:80
<VirtualHost *:80>
 ServerName aa.test.com
 DocumentRoot "D:\wamp\www\test\aa"
<Directory "D:\wamp\www\test\aa">
 Options FollowSymLinks IncludesNOEXEC Indexes
 DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.pl default.pl index.shtml
 AllowOverride None
 Order Deny,Allow
 Allow from all
</Directory>
</VirtualHost>

NameVirtualHost *:80
<VirtualHost *:80>
 ServerName bb.test.com
 DocumentRoot "D:\wamp\www\test\bb"
<Directory "D:\wamp\www\test\bb">
 Options FollowSymLinks IncludesNOEXEC Indexes
 DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.pl default.pl index.shtml
 AllowOverride None
 Order Deny,Allow
 Allow from all
</Directory>
</VirtualHost>




方法2:


1.wamp\bin\apache\Apache2.2.17\conf 下编辑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> 

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>
4.修改C:/WINDOWS/system3/drivers/etc/host这个文件,用记事本打开,加上如下内容:
    127.0.0.1  www.host1.com
5.重启apache ok了


注意事项:ServerName www.host1.com 中的www.可以省略

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值