配置虚拟目录 与配置虚拟主机

来源:互联网 发布:大学男生鞋子推荐知乎 编辑:程序博客网 时间:2024/05/18 03:26
(1)配置虚拟目录
【1】 <IfModule dir_module>
#directory相当于欢迎页面
    DirectoryIndex index.html index.htm index.php
#自己的站点别名
    Alias /myblob "E:/myblob"
    <Directory e:/myblob>
#访问权限设置
    Order allow,deny
    Deny from all
    </Directory>
</IfModule>

【2】注销documentroot路径
#DocumentRoot 
【3】测试
http://localhost/.....
[4]设置欢迎界面:在添加新建的html的文件



(2)配置虚拟主机
【1】在http.conf文件中启用 http-vhosts.conf
就是去掉#
#virtual hosts,虚拟主机
include conf/extra/httpd-vhosts.conf
【2】假设虚拟主机在f盘 f:/myweb【该站点 ,事先有】
【3】设置http-vhosts.conf文件
#配置自己虚拟主机

<VirtualHost 127.0.0.1:80>
 DocumentRoot "f:/myblob"
        #这里配置欢迎首页面
            DirectoryIndex index.html index.htm index.php
    <Directory />
    Options FollowSymLinks
         #不允许别人修改我们的页面
                 AllowOverride None
         #设置访问权限
           Order allow,deny
             Allow from all
         </Directory>
</VirtualHost>
【4】在hosts文件中添加ip 与主机的映射关系
    c:/window/system32/drievr/ect/hosts
127.0.01 www.baidu.com


0 0