PHP本地通过映射,实现多域名访问
PHP本地通过映射,实现多域名访问
第一步:先在C盘下的windows/system32/drivers/etc/hosts文件加上
127.0.0.1 localhost
127.0.0.1 test
127.0.0.1 www.weishang.com
第二步:在Apache的服务器下的conf/extra/httpd-vhosts.conf
加上以上代码:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "E:/wamp/www/"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin postmaster@dummy-host.test
? DocumentRoot "E:/wamp/www/weishang/mobile/"
ServerName test
ServerAlias test
ErrorLog "logs/dummy-host.test-error.log"
CustomLog "logs/dummy-host.test-access.log" combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "E:/wamp/www/weishang/mobile/"
ServerName www.weishang.com
ServerAlias www.weishang.com
ErrorLog "logs/dummy-host.www.weishang.com-error.log"
CustomLog "logs/dummy-host.www.weishang.com-access.log" combined
</VirtualHost>
第三步:在apache/conf/httpd.conf文件里找到
Include conf/extra/httpd-vhosts.conf 并开启
然后重新启动Apache服务器
参考:http://jingyan.baidu.com/article/154b46315e76af28ca8f4135.html
http://hi.baidu.com/baiping588
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。