大网数据广告活动
网站运营与故障问答

How can I display the MD5 or SHA1 of files in a web server directory?

· 52CE 我爱测

When you don't have an index.html , most web servers will show a list of files in the directory. Can I get preferably lighttpd (but Apache as a backup) to do show a file's MD5/SHA1 (along with standard file size, date) with no (o…

问题原文

原帖链接 · plonk420 · CC BY-SA 4.0

When you don't have an index.html, most web servers will show a list of files in the directory.

Can I get preferably lighttpd (but Apache as a backup) to do show a file's MD5/SHA1 (along with standard file size, date) with no (or minimal) other programs involved? If so, how? (Debian on a very very low RAM VPS is the reason.)

已采纳解答

原帖链接 · Simon Hayter · CC BY-SA 3.0

Apache and Lighthttpd both have a directory listing mod that you need to enable, often by default these are disabled for security reasons. You can enable indexing by doing the following:

Lighthttp

To enable directory listings globally:

dir-listing.activate = "enable"

If you need it only for a directory, use conditionals:

$HTTP["url"] =~ "^/download($|/)" {
     dir-listing.activate = "enable" 
   }

Apache

To enable directory listings globally:

<Directory /usr/local/apache2/htdocs/listme>
  Options +Indexes
</Directory>

However...

Directory indexing in both Apache2 and Lighthttpd do not support MDA SHA file hasing, its a simple directory view that allows you to download files, nothing more. You will need to use a PHP file manager or make your own using PHP MD5 File script. It's not a straight forward topic and your have to do some research, or pay for hosting with management.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2015-08-16)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0 / CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。