Wamp环境下配置--Apache虚拟主机
1、首先打开apache的配置文件httpd.conf,并去掉#Include conf/extra/httpd-vhosts.conf前面的#,启用虚拟主机功能
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Listen 127.0.0.1:80
Listen 80
2、先把localhost配置好,将下面信息添加到apache的apache/conf/extra下的配置文件httpd-vhosts.conf后面即可;
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.hleclerc-PC.ingenidev
DocumentRoot "D:\wamp\www\tpshop\www.shop.com"
DirectoryIndex index.html index.php index.htm
ServerName wwww.shop.com
<Directory "D:\wamp\www\tpshop\www.shop.com">
AllowOverride All
Allow from All
</Directory>
</VirtualHost> <VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.hleclerc-PC.ingenidev
DocumentRoot "D:\wamp\www\tpshop\admin.shop.com"
DirectoryIndex index.html index.php index.htm
ServerName admin.shop.com
<Directory "D:\wamp\www\tpshop\admin.shop.com">
AllowOverride All
Allow from All
</Directory> </VirtualHost>
3、修改C:\Windows\System32\drivers\etc下的host文件,用记事本打开,添加
127.0.0.1 admin.shop.com
127.0.0.1 www.shop.com
重启apache即可。
4、配置过程出现的问题
(1)Wamp Error: Could not execute menu item (internal error)
因为主要是修改过httpd.conf才出现的问题,所以将之前修改的配置文件还原,发现原来自己不小心把解释的内容给去注释了,结果导致httpd.conf运行不了
#//不加#会导致httpd.conf 出错
ServerAdmin: Your address, where problems with the server should be
e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin admin@localhost
(2)访问www.shop.com和admin.shop.com总是访问到同一目录,原因是httpd-vhosts.conf在存在多处相同配置
<VirtualHost 127.0.0.1:80> //使用 *:80 匹,否则ip 127.0.0.1 的站点都会使用D:/wamp/www的目录而不会向下查询
DocumentRoot "d:/wamp/www/"
ServerName localhost
<Directory "D:/wamp/www">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost> <VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.hleclerc-PC.ingenidev
DocumentRoot "D:\wamp\www\tpshop\www.shop.com"
DirectoryIndex index.html index.php index.htm
ServerName wwww.shop.com
<Directory "D:\wamp\www\tpshop\www.shop.com">
AllowOverride All
Allow from All
</Directory>
</VirtualHost> <VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.hleclerc-PC.ingenidev
DocumentRoot "D:\wamp\www\tpshop\admin.shop.com"
DirectoryIndex index.html index.php index.htm
ServerName admin.shop.com
<Directory "D:\wamp\www\tpshop\admin.shop.com">
AllowOverride All
Allow from All
</Directory> </VirtualHost>
Wamp环境下配置--Apache虚拟主机的更多相关文章
- windows环境下,apache虚拟主机配置
在windows环境下,apache从配置文件的相关配置: Windows 是市场占有率最高的 PC 操作系统, 也是很多人的开发环境. 其 VirtualHost 配置方法与 Linux 上有些差异 ...
- wamp开发环境配置之配置Apache虚拟主机
网站建设人员在本地测试时,常常不是一个网站,那怎么能像输入域名一样在地址栏上面输入“域名”就能本地访问该网站呢?这里就要配置Apache虚拟主机了! 1.找到apache\conf\httpd.con ...
- 配置LANMP环境(7)-- 配置nginx反向代理,与配置apache虚拟主机
一.配置nginx反向代理 1.修改配置文件 vim /etc/nginx/nginx.conf 在35行http下添加一下内容: include /data/nginx/vhosts/*.conf; ...
- 配置Apache虚拟主机
实验环境 一台最小化安装的CentOS 7.3虚拟机 配置基础环境 1. 安装apache yum install -y httpd 2. 建立虚拟主机的根目录 mkdir /var/wwwroot ...
- wamp环境下配置https证书后,网站内容访问受限
wamp环境下配置https证书后,网站内容访问受限,点击首页链接标签后报错,大致意思是没有权限进行操作. 解决方法:打开apache的http.conf(位置大致如下:项目所在目录\bin\apac ...
- WAMP环境下配置虚拟主机
1.编辑httpd.conf,查找#Include conf/extra/httpd-vhosts.conf,把前面注释符号“#”删掉 2.编辑httpd-vhosts.conf文件, <Vir ...
- 配置apache虚拟主机的实例总结
如何实现apache虚拟主机配置. 1.基于ip地址的虚拟主机Listen 80<VirtualHost 172.20.30.40> DocumentRoot /home/httpd/ht ...
- mac下配置Apache虚拟域名方案,以及遇到的坑(转)
1. 配置Apache虚拟域名 1.执行 sudo vi /etc/apache2/httpd.conf 开始配置httpd.conf 的文件; //配置listen 80端口(默认配置), ...
- mac下配置Apache虚拟域名方案,以及遇到的坑
1. 配置Apache虚拟域名 1.执行 sudo vi /etc/apache2/httpd.conf 开始配置httpd.conf 的文件; //配置listen 80端口(默认配置), ...
随机推荐
- wireshark删除filters记录
- VC 为静态控件添加事件
操作系统:Windows 7软件环境:Visual C++ 2008 SP1本次目的:为静态控件添加事件,如:STATIC.Picture Control等等 有时候我们找到一个图片,为对话框背景添加 ...
- addEventListener()及attachEvent()区别分析
Javascript 的addEventListener()及attachEvent()区别分析 Mozilla中: addEventListener的使用方式: target.addEventLis ...
- List接口实现类-ArrayList、Vector、LinkedList集合深入学习以及源代码解析
学习List接口实现类 ArrayList Vector LinkedList List接口的实现类中最经常使用最重要的就是这三个:ArrayList.Vector.LinkedList. JDK ...
- HDU 1425 sort 题解
选择出数列中前k个最大的数. 这里由于数据特殊.所以能够使用hash表的方法: #include <cstdio> #include <algorithm> #include ...
- 最短路径A*算法原理及java代码实现(看不懂是我的失败)
算法仅仅要懂原理了,代码都是小问题,先看以下理论,尤其是红色标注的(要源代码请留下邮箱,有測试用例,直接执行就可以) A*算法 百度上的解释: A*[1](A-Star)算法是一种静态路网中求解最短路 ...
- No enclosing instance of type Hello is accessible
1.static 关键字 修饰的成员被所有对象共享(包括成员变量和方法). 修饰的成员优先于对象存在. 存储于方法区(共享数据区)的静态区中. 静态方法只能访问静态成员. 静态方法中不可以使用this ...
- 日本IT工作有感
不知不觉,在日本关西已经呆了快一个月了. 除了饮食有点不是非常习惯.其他感觉都还好. 日本这边的文化还是非常偏向project师的,project师的社会地位非常高,公司里面也没有国内所谓35岁的焦虑 ...
- 如何将excel文件中的数百万条数据在1分钟内导入数据库?
在MYSQL里面,使用load data infile 命令就可以了. 步骤很简单 1.先将excel另存为csv格式的文本,csv是以逗号分隔各个字段数据的 2.在mysql中输入sql语句 loa ...
- CF437D(The Child and Zoo)最小生成树
题目: D. The Child and Zoo time limit per test 2 seconds memory limit per test 256 megabytes input sta ...