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端口(默认配置), ...
随机推荐
- json 模块
JSON: JSON-JSON (JavaScript 对象标记) 编码/解码 简介: use JSON; # imports encode_json, decode_json, to_json an ...
- CSS三角形制作样式
.triangle{ display: block; height: 0; position: absolute; width: 0; border: 9px solid; border-color: ...
- 深入浅出Hadoop Mahout数据挖掘实战(算法分析、项目实战、中文分词技术)
Mahout简介 Mahout 是 Apache Software Foundation(ASF) 旗下的一个开源项目, 提供一些可扩展的机器学习领域经典算法的实现,旨在帮助开发人员更加方便快捷地创建 ...
- 基于visual Studio2013解决C语言竞赛题之1056素数序列
题目 解决代码及点评 /* 56. 编程序求3至39之间满足下列条件的各组素数:每组有3个素数,第2个比第一个大2,第3个比第2个大4.例如 5,7,11就是满足条件的一组. 要求: ...
- LINUX 命令行编辑
向 <-前 后 -> 删除 ctrl + d 删除光标所在位置上的字符相当于VIM里x或者dl ctrl + h 删除光标 ...
- jsp和serverlet的差别
開始找工作面试的第一家公司,爱思创新 面试题: 1.jsp和serverlet的差别 简单来说: jsp:是包括java程序片的html文件servlet:是包括html的java文件 事实上说白了J ...
- 解决VTune错误.../lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by ...)
错误信息及出现情景: 在export环境变量LD_PRELOAD=$XTERN_ROOT/dync_hook/interpose.so后,再执行amplxe-gui,出现上述错误.新增的动态链接库对V ...
- webdynpro 下拉列表控件
现在界面上添加下拉列表的控件DropDownByKey 在context中创建新的node,和属性DP 返回界面,绑定DP到控件DropDownByKey的SelectedKey 初始方法中代码如下: ...
- VC++ WIN32 sdk实现按钮自绘详解 之二(关键是BS_OWNERDRAW和WM_DRAWITEM)
网上找了很多,可只是给出代码,没有详细解释,不便初学者理解.我就抄回冷饭.把这个再拿出来说说. 实例图片: 首先建立一个标准的Win32 Application 工程.选择a simple Wi ...
- delphi实现穿XP防火墙
procedure TForm1.Button1Click(Sender: TObject);var FwMgr,Profile,FwApp: variant;begin FwMgr := C ...