apache的虚拟配置与虚拟主机配置

 1.  在httpd.conf下加入如下代码:


<IfModule dir_module>
 DirectoryIndex index.html 
 Alias /myweb1 "D:/myweb1"
 <Directory d:/myweb1>
 Order allow,deny
 Allow from all
 </Directory>
 </IfModule>


然后再把DocumentRoot文件关闭,那么就ok!

前提是要把你所虚拟的路径选好,在进行如上所示。


2.

首先,在httpd.conf文件中启用httpd-vhosts.conf

就是把#注销掉(#cirtual hosts,虚拟主机)

include conf/extra/httpd-vhosts.conf。

然后,在httpd-chosts.conf文件中配置如下:

<VirtualHost 127.0.0.1:80>
DocumentRoot "d:/myweb1"

#waa.html是欢迎首页页面
DirectoryIndex waa.html index.html index.htm index.php
<Directory />
Options FollowSymLinks

#不准别人修改我们的页面
AllowOverride None

#设置访问权限
Order allow,deny
Allow from all 
</Directory>

</VirtualHost>


3.修改hosts文件添加我们的ip和主机映射关系

c:/windows/system32/drivers/etc/hosts



 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值