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