最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
apache开启目录浏览功能的方法
时间:2022-06-25 00:11:18 编辑:袖梨 来源:一聚教程网
主配置文件 httpd.conf 中修改:
1)添加支持模块。
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule dir_module modules/mod_dir.so
注意一定要拥有这两个模块,否则下面的配置不生效,返回404 Not Found错误。
这个模块也有可能直接编译到Apache核心文件httpd中去了。
2)为DocumentRoot目录添加Options Indexes,即可生成目录。
Options Indexes FollowSymLinks
这里Indexes控制是否打开目录浏览,如果要关闭目录浏览,使用
Option -Indexes
3)加载 httpd-autoindex.conf 配置
Include conf/extra/httpd-autoindex.conf
例子
在http.conf中加入如下代码(如有虚拟主机配置,加载到虚拟主机配置段内)
1 Alias /dist "I:/build/dist"
2
3 #开启目录列表索引模式
4 Options Indexes
5 Order allow,deny
6 IndexOptions NameCharset=UTF-8
7 Allow from all
8
其中"I:/build/dist"是要显示文件列表的目录,参数"Options Indexes"表示启用目录浏览,"IndexOptions Charset=UTF-8"设置字符集,以消除中文乱码,Name:指定目录列表可以显示最长为25字节的文件/目录名。
相关文章
- 原神遐思套和断章套给谁用 原神4.6版本新圣遗物适用角色推荐 04-19
- 物华弥新战天月怎么打 物华弥新战天月打法攻略 04-19
- 梦幻西游怎么在藏宝阁卖东西 04-19
- 星际战甲前期干什么好 04-19
- 率土之滨灵帝怎么加点 04-19
- 原神妮露对单能力怎么样 04-19