本地配置独立域名环境

1、开启虚拟主机配置项(以apache为例)

#Include conf/extra/httpd-vhosts.conf
//把前面的#(注释去掉)开启
修改后需重启apache

 

2、设置文件httpd-vhosts.conf(\conf\extra)

<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "D:/wamp/www/renwu" (//文档根目录)
ServerName www.mytest.com (//主机地址)
</VirtualHost>

修改后需重启apache


3、配置hosts文件(c盘...etc目录下)

添加

127.0.0.1 www.mytest.com

注意把前面的#(注释去掉)

posted @ 2018-10-17 14:26  shenxinpeter  阅读(959)  评论(0编辑  收藏  举报