码迷,mamicode.com
首页 > Web开发 > 详细

PHP本地通过映射,实现多域名访问

时间:2015-04-22 17:33:50      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:

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 postmaster@dummy-host.localhost
    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 postmaster@dummy-host.www.weishang.com
    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

PHP本地通过映射,实现多域名访问

标签:

原文地址:http://www.cnblogs.com/wangyuman26/p/4447878.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!