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端口(默认配置), ...
随机推荐
- Perl 面向对象编程的两种实现和比较:
<pre name="code" class="html">https://www.ibm.com/developerworks/cn/linux/ ...
- asp.net2.0安全性(2)--用户个性化设置(2)--转载来自车老师
上一篇我们用Profile.age等方式可以读取用户的年龄和其它的信息,但有的时候我们要查询显示所有用户的信息,但asp.net没有提供查询所有用户信息的功能,我们只能对现有的用户逐一查询其Profi ...
- Taxonomy of class loader problems encountered when using Jakarta Commons Logging(转)
Acknowledgments I would like to thank Jacob Kjome for reviewing early drafts of this document. His c ...
- 【小白的java成长系列】——javakeyword
准备出一个系列的内容啦,今天就从keyword開始说起吧~ 类型 keyword 说明 keyword 说明 訪问控制权限 public 公共的.公开的. protected 受保护的.用来修饰属性或 ...
- 怎样成为一个游戏制作人——第五章:使用GGE图形库来写游戏
怎样成为一个游戏制作人--第五章:使用GGE图形库来写游戏 前言: 细致想了一下,来看博客的一般都是有自学能力的了.C++基础多少也会有一些了. 于是决定以下的章节.会教大家做一些小游戏. 来巩固自己 ...
- gbs remotebuild使用说明
本文件从:https://source.tizen.org/documentation/articles/gbs-remotebuild翻译而来. 1 远程构建 使用remotebuild子指令将本地 ...
- Java中@Deprecated、@SupressWarning、@Override的作用
Annotation注解在 Java 中有着很广泛的,他是做为一种标识 为javac所识别.每一个注解 都对应这一个Java类 在java.lang包中 有三个注解 分别是 Deprecated ...
- C#递归复制文件夹
/// <param name="sources">原路徑</param> /// <param name="dest">目 ...
- Centos系统各种日志存详解
Centos系统各种日志存储路径和详细介绍 Linux常见的日志文件详述如下 1./var/log/boot.log(自检过程) 2./var/log/cron (crontab守护进程crond所派 ...
- display:table 水平居中
<div style="width:auto; margin:auto;display:table"> <div style="width: 100px ...