配置自己的虚拟主机: 1.启用 httpd-vhosts.conf 文件-->在httpd.conf文件中启用 打开httpd.conf文件,从中找到httpd-vhosts节点 这是关闭状态 这是打开状态 2.在apache目录下的conf/extra 文件夹中找到httpd-vhosts.conf文件 在文件中添加如下代码: <VirtualHost 127.0.0.1:80> DocumentRoot "e:/wamp/www" #这里配置欢迎首页面 DirectoryIndex index.html <Directory /> Options FollowSymLinks #不许可别人修改我们的页面 AllowOverride None #设置访问权限 order allow,deny Allow from all </Directory> </VirtualHost> !!修改完一定要重启服务器 3.在host文件中找到ip 与 域名对应关系(host文件路径:C:\Windows\System32\drivers\etc) 以百度为例,我要本地ip指向www.baidu.com这个域名 只要在host文件中添加如图代码即可 4.测试 在浏览器中输入www.baidu.com将出现本地服务器中的页面 至此虚拟主机已经配置完成
|
|