`
IT男男
  • 浏览: 14693 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

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了
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics