首页 技术 正文
技术 2022年11月18日
0 收藏 556 点赞 4,928 浏览 1242 个字

 

主配置文件 httpd.conf 中修改:

1)添加支持模块

LoadModule autoindex_module modules/mod_autoindex.so

LoadModule dir_module modules/mod_dir.so

注意一定要拥有这两个模块,否则下面的配置不生效,返回404 Not Found错误。

这个模块也有可能直接编译到Apache核心文件httpd中去了。

可以使用httpd –l 查看是否静态包含了这个模块。

如果不存在就在modules文件夹中查看是否拥有这个模块。

2)为DocumentRoot目录添加Options Indexes,即可生成目录

<Directory “/usr/local/apache2/htdocs”>

Options Indexes FollowSymLinks

</Directory>

这里Indexes控制是否打开目录浏览,如果要关闭目录浏览,使用

Option -Indexes

3)加载 httpd-autoindex.conf 配置

Include conf/extra/httpd-autoindex.conf

在配置文件httpd-autoindex.conf中的修改:

IndexOptions FancyIndexing HTMLTable VersionSort NameWidth=* FoldersFirst Charset=UTF-8 SuppressDescription SuppressHTMLPreamble

其中

FancyIndexing 支持美化显示;

HTMLTable 允许底层代码把文件列表生成在一个table元素里面;

VersionSort 安装版本排序;

NameWidth=* 页面自动匹配文件名宽度;

FoldersFirst 安装文件夹优先排列;

Charset=UTF-8 支持中文显示;

SuppressDescription 不显示文件描述;

最后一个忘记是什么了,去看apache 官网的说明。。。

2.apache  原生目录实在难看 。还好有改善的方法。网上有 H5AI 的模版可以下载使用。但现在是用在嵌入式平台,资源有限,只做了参考。

1)apache提供配置两个文件,以便修饰页面。

# ReadmeName is the name of the README file the server will look for by

# default, and append to directory listings.

#

# HeaderName is the name of a file which should be prepended to

# directory indexes.

ReadmeName /footer.shtml (文件前必须加/,使用绝对路径,否则子目录无法继承该文件)

HeaderName /header.shtml

这两个文件放于DocumentRoot目录下。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,489
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,904
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,737
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,489
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,128
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,290