因为要用 ThinkPHP 的当前最新版本 3.2.2,对应要求 PHP 的版本要高于 5.3.0,所以安装了 WampServer 2.2 ( Apache 2.2.21,PHP 5.3.10,MySQL 5.5.20) ,顺便记录一下在 httpd.conf 中配置多站点。

第一步:

安装 WampServer。我的安装路径是 D:\wamp\

第二步:

修改 D:\wamp\bin\apache\Apache2.2.21\conf\extra\httpd-vhosts.conf

在文件的最后加上:

<VirtualHost *:80>

    DocumentRoot "D:/practise/php"
ServerName www.dee.com
<Directory "D:/practise/php">
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>

其中 D:/practise/php 是放置 PHP 项目的路径。

第三步:

在 httpd.conf 中找到如下代码:

<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

修改为:

<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>

第四步:

配置多站点。在 httpd.conf 中找到:

ServerName localhost:80

和

<FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>

把这两段中间的内容替换为:

DocumentRoot "d:/wamp/www/"

<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory> <Directory />"d:/wamp/www/"
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</Directory> <VirtualHost 127.0.0.2>
ServerName 127.0.0.2
DocumentRoot "d:/mynewweb"
</VirtualHost> <VirtualHost 127.0.0.3>
ServerName 127.0.0.3
DocumentRoot "d:/myqg"
</VirtualHost>

注:如果不希望显示目录索引,就把 Options Indexes FollowSymLinks 中的 Indexes 去掉,则此时访问目录,目录为空或者不存在 index.php 或者 index.html 等文件时会显示 403 Forbidden。

设置默认的索引页的方式是在 httpd.conf 中加上

<IfModule dir_module>
DirectoryIndex index.htm index.html index.php
</IfModule>

以上配置说明了目录中的默认索引页可以是 index.htm,index.html,index.php,可以通过调整它们之间的顺序来调整优先级。

每添加一个新的站点,按照上面最后两端的格式添加即可。

附:域名配置法

第 ① 步:

在 http.conf 中,把 Include conf/extra/httpd-vhosts.conf 前面的 "#" 去掉

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

第 ② 步:

在 httpd-vhosts.conf (D:\wamp\bin\apache\Apache2.2.21\conf\extra)文件的最后,添加:

<VirtualHost *:80>
ServerAdmin dee.com
DocumentRoot "F:/www/newcrm"
ServerName dee.com
ServerAlias dee.com <directory "F:/www/newcrm">
Options FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</directory>
</VirtualHost>

注:F:/www/newcrm 为项目目录

第 ③ 步:

在 hosts 中添加:

127.0.0.1 dee.com

参考《教你wamp下多域名如何配置》

WampServer 在 httpd.conf 中配置多站点 (IP 配置法:不用每次修改 hosts 文件 + 域名配置法 )的更多相关文章

  1. Android手机中怎么样在没root的情况下 修改 hosts 文件

    工具  链接:https://pan.baidu.com/s/1AENluDCQ-2qYDPcE5K6l8g 密码:t7eu  http://bbs.360.cn/forum.php?mod=view ...

  2. Php和httpd.conf的配置

    http://www.cnblogs.com/homezzm/archive/2012/08/01/2618062.html http://book.51cto.com/art/201309/4096 ...

  3. httpd.conf简单配置

    本文介绍apache中httpd.conf的配置.该配置也可解决打开php文件却变成下载的尴尬情况 1 修改网站根目录查找DocumentRoot有这么一行DocumentRoot "C:/ ...

  4. openerp-server.conf 中配置 dbfilter 参数无效的解决办法

    来自:http://shine-it.net/index.php/topic,14517.html 以前就发现过这个问题, 今天重新在群里同大家讨论了一下. 有时候可能我们希望用户不从登陆界面的账套选 ...

  5. Nginx的配置文件简介及在Nginx中配置基于不同ip的虚拟主机

    Nginx的配置文件简介及在Nginx中配置基于不同ip的虚拟主机: #user nobody; worker_processes 1; #error_log logs/error.log; #err ...

  6. appserv 设置虚拟路径httpd.conf的配置

    总结 1 打开appserv的安装目录,找到httpd.conf文件,分别去掉下面两行文字前面的#号. #LoadModule vhost_alias_module modules/mod_vhost ...

  7. linux上安装apache以及httpd.conf基本配置

    1.yum安装apache #yum install httpd -y 2.随系统自启动 #chkconfig httpd on 3.开启apache #service httpd start PS: ...

  8. 如何在Windows Server 2003中配置FTP站点服务

    前面写过一篇文章<怎样给你的网站注册一个好域名?> ,讲到“玉米”,笔者有很深的情节,也希望与大家交流“米事”,可以站内私信我或者直接回复文章. 有了好域名只是做网站的开始.我们还要买主机 ...

  9. 如何在appconfig中配置服务的ip

    开发了一个WindowsService消息服务器,刚开始一直都是在代码中把IP地址写死,所以每次只要是更换了新的IP地址后,都需要重新编译项目.所以考虑把ip配置到config文件中, 这样做的好处是 ...

随机推荐

  1. Android ViewHolder工具

    import android.util.SparseArray; import android.view.View; /** * 封装了setTag()和getTag()方法 * 封装了findVie ...

  2. poj 1019

    懂了 题意是给一串 1 12 123 1234 12345 123456 ....这样的数字问第 i个数字是多少 Sample Input 2 8 3 Sample Output 2 2 #inclu ...

  3. java线程安全总结

    转自:http://blog.csdn.net/haolongabc/article/details/7249098 最近想将java基础的一些东西都整理整理,写下来,这是对知识的总结,也是一种乐趣. ...

  4. c语言 struct 的初始化

    转自:http://www.cnblogs.com/silentjesse/archive/2013/07/30/3225212.html struct数据有3中初始化方法:顺序,C风格及C++风格的 ...

  5. C++Premer Plus学习(五)——函数探幽

    一.内联函数 1.优点: 内联函数就是比较省资源,然后一般就是将简短,使用频率高的函数作为内联函数会比较合适. 2.一个demo #include "stdafx.h" #incl ...

  6. python安装requests (win7 & centos7)

    下载地址: http://pypi.python.org/pypi/requests/只有tart.gz包 解压后,进入目录,安装命令: python setup.py install 会出现:Imp ...

  7. ural 1431. Diplomas

    1431. Diplomas Time limit: 1.0 secondMemory limit: 64 MB It might be interesting for you to learn th ...

  8. IE6/7/8兼容问题、时间对象返回NAN

    IE浏览器不支持new Date()带"2,31,2013"这样格式的参数,要换成“2/31/2013”.'2013-05-05'.replace(/-/g,'/')

  9. C#多线程与异步的区别

    随着拥有多个硬线程CPU(超线程.双核)的普及,多线程和异步操作等并发程序设计方法也受到了更多的关注和讨论.本文主要是想与园中各位高手一同探讨一下如何使用并发来最大化程序的性能. 多线程和异步操作的异 ...

  10. 【wikioi】1250 Fibonacci数列(矩阵乘法)

    http://wikioi.com/problem/1250/ 我就不说这题有多水了. 0 1 1 1 矩阵快速幂 #include <cstdio> #include <cstri ...