代码改变世界

apache下面模拟两个不同域名下的文件的访问

2016-07-15 15:36  Gamehu  阅读(460)  评论(0)    收藏  举报

1.找到hosts文件,添加内容如:127.0.0.1  www.a.com ,  127.0.0.1  www.b.com 等

2.找到apache的httpd.conf修改把directory修改为Allow from all

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

去掉Include conf/extra/httpd-vhosts.conf之前的#

# Virtual hosts
#开启虚拟主机
Include conf/extra/httpd-vhosts.conf

 

(3)找到apache下面的httpd-vhosts.conf文件

添加

<VirtualHost *:80>
DocumentRoot "E:/kuayu/b"

ServerName www.b.com

ErrorLog "logs/b-error.log"

CustomLog "logs/b-access.log" common
</VirtualHost>

 

servername需要和hosts中的域名对应