虚拟主机的配置

1、httpd.conf中把

<Directory />  
    Options FollowSymLinks  
    AllowOverride None  
    Order deny,allow  
    Deny from all  
</Directory>

改成

<Directory />  
    Options FollowSymLinks  
    AllowOverride None  
    Order deny,allow  
#   Deny from all  
</Directory>

2、在httpd.conf末端加上此代码:

<VirtualHost *:80>
    DocumentRoot "D:\wamp\www"
    ServerName localhost
</VirtualHost>


<VirtualHost 127.0.0.2:80>
    DocumentRoot "D:\wamp\www\test"
    ServerName www.test.com
</VirtualHost>

<VirtualHost 127.0.0.3:80>
    DocumentRoot "C:\Users\Administrator\git\ZMT58"
    ServerName www.zmt.com
</VirtualHost>

3、在C:\Windows\System32\drivers\etc中找到hosts,最下面修改以下代码:

# localhost name resolution is handled within DNS itself.
    127.0.0.1       localhost
    127.0.0.2       www.test.com
    127.0.0.3       www.zmt.com
#    ::1             localhost

 

posted @ 2015-12-16 10:59  屌丝IT男  阅读(170)  评论(0编辑  收藏  举报