windows apache 本地多域名配置

 

本文转自:http://www.hellocy.com/Article/index/aid/17

 

1.打开apachehttpd.conf文件,找到
<Directory />

Options FollowSymLinks

AllowOverride None

Order deny,allow

Deny from all

</Directory>

AllowOverride None 改为AllowOverride All

 

 

2.   接着在该文件中找到
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf


这一段把Include conf/extra/httpd-vhosts.conf前面的"#"去掉。

3. 
修改位于(win7)c:/windows/system32/drivers/etc/目录下的hosts文件
增加:

127.0.0.1    domain1

127.0.0.1    domain2



4. 
我用的是wamp包,所以到c:/wamp/bin/apache/Apache2.2.11/conf/extra目录下
修改文件httpd-vhosts.conf
NameVirtualHost
默认如下:
NameVirtualHost *:80
增加:
<VirtualHost *:80>
    ServerAdmin imbareman@sina.com   
    DocumentRoot "C:/wamp/www/ domain1"
    ServerName domain1
    ErrorLog "logs/x.acme.com-error.log"
    CustomLog "logs/x.acme.com-access.log" common
</VirtualHost>

 

<VirtualHost *:80>
    ServerAdmin imbareman@sina.com   
    DocumentRoot "C:/wamp/www/ domain2"
    ServerName domain2
    ErrorLog "logs/x.acme.com-error.log"
    CustomLog "logs/x.acme.com-access.log" common
</VirtualHost>

改好然后重启服务器。
在浏览器中输入http:// domain1 http:// domain2就可以到你的目录.

posted on 2015-11-22 17:07  源人  阅读(124)  评论(0)    收藏  举报

导航