你可以全用本地私有ip地址创建多个站点 127.0.0.x,这个网段的所有ip都是指向本机的,并且可以区分,这是计算机的私有ip地址,供测试用的,配置方法如下

一、打开httpd.conf

1、从ServerAdmin admin@localhost

一直到:

<IfModule dir_module>

DirectoryIndex  index.html index.php  index.php3  index.htm

</IfModule>

2、在D盘创建文件夹d:/website做为所有站点的父文件夹,以后的子站点全部放到这个文件夹内。

3、将刚才找到的区域代码修改如下:

ServerAdmin admin@localhost

ServerName localhost:80

<Directory />

Options FollowSymLinks

AllowOverride All

Order deny,allow

Deny from all

</Directory>

<Directory "d:/website/">

Options Indexes FollowSymLinks

AllowOverride all

Order Deny,Allow

Deny from all

Allow from all

</Directory>

<IfModule dir_module>

DirectoryIndex  index.html index.php  index.php3  index.htm

</IfModule>

#上面这句话是让apache对website及子文件夹有完全访问的权限,以后的站点全部放在该目录下

二、子站点配置方法



1、在httpd.conf文件中,找到

# Virtual hosts

# Include conf/extra/httpd-vhosts.conf

修改为

# Virtual hosts

Include d:/website/httpd-vhosts.conf

2.在 wamp/bin/apache/apache2.2.17/conf/extra/找到httpd-vhosts.conf文件,

复制到:d:/website文件夹下

3.在d:/website/创建子站点文件夹, 假如:d:/website/wwwroot1/

4.修改 d:/website/httpd-vhosts.conf 文件的内容

<VirtualHost 127.0.0.2:80>

DocumentRoot "d:/website/wwwroot1/"

ServerName 127.0.0.2

</VirtualHost>

5.保存httpd.conf,保存httpd-vhosts.conf,然后重启apache 服务

6.测试 在wwwroot1,下创建文件:index.php  用记事本来写入这些代码:

<?php

phpinfo();

?>

保存,然后打开浏览器,在地址栏里输入:http://127.0.0.2 会出现相关信息

7.建第二个站点,在website目录创建文件夹:d:/website/wwwroot2/

打开文件:d:/website/httpd-vhosts.conf

在追加站点配置代码如下:

<VirtualHost 127.0.0.3:80>

DocumentRoot "d:/website/wwwroot2/"

ServerName 127.0.0.3

</VirtualHost>

根据第5,6步进行重启服务与测试

三、到hosts下将需要的ip修改为方便记忆输入的域名。

hosts路径:C:\Windows\System32\drivers\etc

127.0.0.2    localhost2

最新文章

  1. hdu-2444-二分图判定+最大分配
  2. 【CQgame】[下一百层] [Down]
  3. [CareerCup] 17.7 English Phrase Describe Integer 英文单词表示数字
  4. linux 安装redmine 遇到的问题
  5. iOS 时间处理(转)
  6. 如何分割一个utf8字符串(保证单个汉字的完整性)
  7. SQL查询中关于索引使用的笔记
  8. mongodb .net driver
  9. 局部化原理(Laplace渐进估计方法)
  10. UltraEdit 列模式
  11. 将FAT32格式转换成NTFS格式命令
  12. js垃圾回收机制
  13. UWP 使用Telerik Grid控件
  14. anylogic 使用
  15. append和appendTo的区别!
  16. 运输计划NOIP2015Day2T3
  17. 星图智控推嵌入式家用AI摄像头
  18. Javascript删除数组里的某个元素
  19. web@css样式进阶--图形字体、动画、显隐....
  20. Mysql错误:ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

热门文章

  1. 求第N个素数
  2. 树莓派3b+ 用samba与windows共享文件
  3. backbone学习笔记一
  4. 把应用程序exe 注册成为windows 服务的方法
  5. 使用UEditor 的时候,ajax注意使用同步的方法
  6. 注入语句详解(get注入,cookie注入,搜索型注入等)
  7. SQL异常:ORA-00936: missing expression
  8. php判断字符串A是否含有字符串B
  9. Visual Studio中删除所有空行
  10. linux信号机制与python信号量