Apache配置虚拟目录

来源:互联网 发布:黄金交易软件排名 编辑:程序博客网 时间:2024/05/01 07:13
找到conf/httpd.conf配置文件

找到:
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

修改为:

 

<IfModule dir_module>
    #DirectoryIndex index.html
 
 #设置站点别名,别名与访问路径是相关的,取任何名称都可以(除特殊)  
 Alias /maojd "F:/hello"  
 <Directory "F:/hello">
 #设置访问权限
 Options +Indexes
 Order deny,allow
 IndexOptions Charset=UTF-8
 Allow from all
 </Directory>
</IfModule>


浏览器输入:http://localhost/maojd 即可访问F:/hello目录

解释说明:
#DirectoryIndex index.html
不注释掉的话,http://localhost/maojd默认去找 F:/hello下的index.html,有这个文件则访问index.html.没有这个文件则直接显示hello目录。
+Indexes+改成-号的话,可以访问html页面,不能访问目录。
 Alias /maojd "F:/hello"# 设置站点别名
Allow from all”改成 “Deny from all”,整个网站都不能被打开。 


0 0