建站软件 优化软件 编程软件 网页辅助 站群程序 网站程序 图像处理 资源教程 字体下载 推荐软件


您的位置:首页 > 建站必知 > 本地怎么配置多个域名测试

本地怎么配置多个域名测试

时间:2015-10-05 10:47:58  来源:免费模板网 作者:风雪 阅读次数 tags多个域名

有时候在自己电脑做服务器环境测试,域名换来换去很是麻烦,怎么解决这个问题呢比如我本地的地址是127.0.0.1/test1   域名是www.test1.com   怎么让本地电脑就类似服务器的环境呢


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    localhost
127.0.0.1    www.test1.com


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>

改好然后重启服务器。
关闭网络,打开wamp 输入域名

这样就比用总是切换域名那么麻烦了


本文地址:https://www.freemoban.com/jzbz/2015/1005/2496.html

猜你喜欢
栏目推荐
模板推荐

Copyright:www.freemoban.com 免费模板网 All Rights Reserved 网站备案:辽ICP备19014872号-2   辽公网安备 21010602000376号  辽公网安备:42900402000182号

免责声明:本站部分资源来自互联网收集,版权归原创者所有,如果侵犯了你的权益,我们会及时删除侵权内容,联系QQ:1615187561 谢谢合作!