windows apache 本地多域名配置
本文转自:http://www.hellocy.com/Article/index/aid/17
1.打开apache的httpd.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就可以到你的目录.
浙公网安备 33010602011771号