wamp环境下配置vhost
2016-05-14 11:48
561 查看
第一步:修改http.conf文件,将http-vhosts.conf配置文件包含进来
在第一个例子中只改动了servername和documentRoot,这个配置保证了我们在开启vhost后仍然可以访问www目录。
在第二个例子中,除了修改serverName和documentRoot以外,还添加了Directory那句话,如果不添加这句话,当我们访问rocket3.com的时候会报403权限的错误。
第三步:修改C:\Windows\System32\drivers\etc\hosts文件
# Virtual hosts #Include conf/extra/httpd-vhosts.conf 改为 # Virtual hosts Include conf/extra/httpd-vhosts.conf第二步:配置http-vhosts.conf
# VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ServerName or ServerAlias in any <VirtualHost> block. # <VirtualHost *:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot "D:\wamp\www" ServerName localhost ServerAlias www.dummy-host.example.com ErrorLog "logs/localhost-error.log" CustomLog "logs/localhost-access.log" common </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@dummy-host2.example.com DocumentRoot "F:\fast_rocket3" ServerName rocket3.com ErrorLog "logs/rocket3.com-error.log" CustomLog "logs/rocket3.com-access.log" common <Directory /> Require all granted </Directory> </VirtualHost>http-vhost.conf文件中给了两个例子,我们只要在例子上稍微做些改动就可以:
在第一个例子中只改动了servername和documentRoot,这个配置保证了我们在开启vhost后仍然可以访问www目录。
在第二个例子中,除了修改serverName和documentRoot以外,还添加了Directory那句话,如果不添加这句话,当我们访问rocket3.com的时候会报403权限的错误。
第三步:修改C:\Windows\System32\drivers\etc\hosts文件
# localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 127.0.0.1 localhost 127.0.0.1 rocket3.com最后一步:重启wamp
相关文章推荐
- activiti modeler在线编辑器关闭跳转路劲自定义
- Fibonacci
- Java对象的克隆
- 【图文详解】scrapy爬虫与动态页面——爬取拉勾网职位信息(2)
- java构造器小结
- hdu 1087 递增子序列和
- rsync+inotify实时备份加nfs挂载实战
- 二叉树镜像(交换左右子树)
- R语言笔记之语法篇
- struct 字节对齐详解
- java: 四器 之 适配器初学
- Redis 1:简介
- Redis 1:简介
- <Android 应用 之路> 天气预报(四)
- <Android 应用 之路> 天气预报(四)
- Spark入门实战系列--4.Spark运行架构
- 转载的一些些
- 使用百度云加速防apache的ab测试
- Nodejs和R交互
- Servlet学习(三)Servlet编程实例-网站登录(修改版-增加数据库-附源码)