apache本机环境配置虚拟访问域名

1、打开%ApacheDir%/conf/httpd.conf,找到
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
把第二行前面的注释去掉,这样就可以通过修改httpd-vhosts.conf文件来达到配置虚拟主机的目的。
2、然后在httpd-vhosts.conf文件内容配置如下内容
<VirtualHost 127.0.0.1:802>
ServerAdmin [email protected]
DocumentRoot "D:/OpenSource/wamp/www/"
ServerName localhost
ServerAlias www.dummy-host.localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" common
</VirtualHost>

<VirtualHost 127.0.0.1:802>
ServerAdmin [email protected]
DocumentRoot "D:/OpenSource/wamp/www/"
ServerName www.gtlions.com
ServerAlias gtlions.com
ErrorLog "logs/dummy-gtlions.com-error.log"
CustomLog "logs/dummy-gtlions.com-access.log" common
</VirtualHost>
3、最后修改hosts文件,在c:/windows/system32/drivers/etc/下面,添上两条
127.0.0.1 www.gtlions.com
127.0.0.1 gtlions.com

-The End-


你可能感兴趣的:(apache,c,include)