几个极简的目录列表程序试用和比较。
1. DirectoryLister
功能:
- 支持中文。
- 可以搜索所有文件。
- 可以查看文件Hash。
- 可以渲染目录中的README.md作为目录说明。
- 可以使用zip文件的方式下载一个目录。
缺点:
- 没有密码功能。

安装配置:
部署好php环境后,只需要解压就可以了。配置DirectoryLister只需要设置.env文件:
APP_DEBUG=false APP_LANGUAGE=zh-CN DISPLAY_READMES=true READMES_FIRST=true ZIP_DOWNLOADS=true GOOGLE_ANALYTICS_ID=false MATOMO_ANALYTICS_URL=false MATOMO_ANALYTICS_ID=false SORT_ORDER=name REVERSE_SORT=false SITE_TITLE=DirectoryLister
2. Evoluted Directory Listing Script
只有一个单独的index.php文件,只需要配置好,放在目录里就可以了。
功能:
- 可以设置密码。
// Set to true to require a password be entered before being able to use the script public $passwordProtect = true; // The password to require to use this script (only used if $passwordProtect is set to true) public $password = '1234';

- 可以关闭上传文件、创建目录、删除文件的功能,只作为简单列表使用。
// Set to true to allow file uploads (NOTE: you should set a password if you enable this!) public $enableUploads = true; // Set to true to allow new directories to be created. public $enableDirectoryCreation = true; // Set to true to enable file deletion options public $enableFileDeletion = true;
- 可以设置允许访问的IP。
// Optional. Allow restricted access only to whitelisted IP addresses public $enableIpWhitelist = false;
缺点:
- 只能搜索对应目录下的文件。

3. Nginx fancyindex
功能:
- 自定义主题。
- 密码功能可以通过nginx实现。
- 可以渲染目录中的HEADER.md作为目录说明。
缺点:
- 只能搜索对应目录下的文件。
可以配置的选项:
fancyindex_default_sort fancyindex_directories_first fancyindex_css_href fancyindex_exact_size fancyindex_name_length fancyindex_footer fancyindex_header fancyindex_show_path fancyindex_show_dotfiles fancyindex_ignore fancyindex_hide_symlinks fancyindex_hide_parent_dir fancyindex_localtime fancyindex_time_format
