apache服务器—虚拟目录+虚拟主机

-------【虚拟目录设置】------
1、打开apache的conf目录下httpd.conf
2、注释#DocumentRoot "D:/apache2.2/htdocs"
3、在<IfModule dir_module>后添加代码
<IfModule dir_module>
    #欢迎页面
    DirectoryIndex index.html index.htm index.php
    #站点的别名
    Alias /myblog "D:/myblog"
    <Directory d:/myblog>
    #访问权限
    Order allow,deny
    Allow from all
    </Directory>
</IfModule>
4、访问http://localhost:80/myblog
-----------【虚拟主机设置】---------
1、启动 httpd-vhosts.conf
在 httpd-conf 文件中打开
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
2、在httpd-vhosts.conf文件中做配置
<VirualHost 127.0.0.1:80>
    DocumentRoot "d:/myblog"
    DirectoryIndex index.html index.htm index.php
    <Directory d:/myblog>
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>
</VirtualHost>
3、修改hosts文件 C:\WINDOWS\system32\drivers\etc\hosts
127.0.0.1  www.bkk.com
4、访问www.bkk.com

posted @ 2014-11-05 17:47  王八一瓶子  阅读(437)  评论(0编辑  收藏  举报