碎碎念
测试了许多轻量文件目录列表程序,最让我满意的是h5ai
,当然除了上传以外.
另外让我觉得不错的是Tiny File Manager
,用一句话形容就是"麻雀虽小,五脏俱全".
两者搭配一下或者随便找一个程序用于上传也不错 hhh
文章将中英混杂,问就是懒,不想看或看不懂跳过就行,重要内容依旧是用中文
介绍
H5ai 是一款功能强大界面美观的 php
文件目录列表程序,由德国开发者 Lars Jung 主导开发,它提供多种文件目录列表呈现方式,支持多种主流 Web
服务器,例如 Nginx
、Apache
、Cherokee
、Lighttpd
等,支持多国语言,可以使用本程序在线预览文本、图片、音频、视频等。
h5ai is a modern file indexer for HTTP web servers with focus on your files. Directories are displayed in a appealing way and browsing them is enhanced by different views, a breadcrumb and a tree overview. Initially h5ai was an acronym for HTML5 Apache Index but now it supports other web servers too.
Requires PHP 5.5+ and works fine with Apache httpd, lighttpd and nginx. Best user experience with the latest versions of Chromium-based browsers, Firefox, Safari and Edge, but a static fallback is provided for older browsers or if JavaScript is disabled.
功能
There are lots of optional extensions and configuration options to customize the web appearance of your directory listings. All markup is valid HTML5 spiced up with CSS3 and finest JavaScript to build a fresh but minimal user interface and a user experience that focuses on your files.
Some of the optional features are: file sorting, different view modes, localization, a breadcrumb, a tree view, custom headers and footers, file filter and search, folder sizes, auto refresh, packaged download, QR codes, thumbnails, file previews.
项目地址
https://larsjung.de/h5ai/看得懂的可以看官方教程 hhh
安装
下载
下载并上传 h5ai 程序到根目录
官网下载最新版本: https://release.larsjung.de/h5ai/
然后上传到网站根目录
目录关系
DOC_ROOT
├─ _h5ai
├─ your files
└─ and folders
将public
和private
权限设置为 777
修改 Nginx 配置文件
根据不同系统,修改当前域名下的Nginx
配置文件
在root
一行把/_h5ai/public/index.php
添加进去
Apache httpd 2.2 / 2.4:httpd.conf
.hatcces
DirectoryIndex index.html index.php /_h5ai/public/index.php
lighttpd 1.4:lighttpd.conf
index-file.names += ("index.html", "index.php", "/_h5ai/public/index.php")
nginx 1.2:nginx.conf
index index.html index.php /_h5ai/public/index.php;
Cherokee 1.2: cherokee.conf
vserver!1!directory_index = index.html,index.php,/_h5ai/public/index.php
最后重启Apache
或Nginx
即可
如宝塔面板,只需在网站-设置-配置文件
中添加即可!注:记得删除原目录的 html
,否则可能显示默认网页.
修改 PHP 配置
php
配置文件路径:/usr/local/php/etc/php.ini
搜索:disable_functions
找到下列内容
disable_functions=passthru,exec,system,chroot,scandir,...
删除scandir
、exec
、passthru
保存
重启php
: /etc/init.d/php-fpm restart
如宝塔面板,需先搜索需要禁用的函数scandir
,然后找到scandir
、exec
、passthru
删除并重启php
.
检测 H5ai 系
访问:http://YOUR-DOMAIN.TLD/_h5ai/public/index.php
检测h5ai
系统兼容性并选择性安装拓展
Visit to see if everything works fine. In this example you need to add to your index-file list (as in step 3 above).
http://YOUR-DOMAIN.TLD/some/folder/_h5ai/public/index.php/some/folder/_h5ai/public/index.php
点击 login 登录即可
安装拓展
FFmpeg/avconv
Ubuntu/Debian
详情:http://ffmpeg.org/download.html 根据此处也能安装
打开 /etc/apt/sources.list
添加软件源
deb http://www.deb-multimedia.org jessie main non-free
deb ftp://ftp.deb-multimedia.org jessie main non-free
deb http://www.deb-multimedia.org stable main non-free
deb ftp://ftp.deb-multimedia.org stable main non-free
update
更新软件源
- avconv
apt-get install libav-tools
- FFmpeg
apt-get -y install ffmpeg
CentOS
- 安装证书
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
- 安装 RPMForge 源
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
可参考:
https://rpmfusion.org/
https://rpmfusion.org/Configuration
- 安装 FFmpeg 和 FFmpeg 开发包
sudo yum install ffmpeg ffmpeg-devel -y
上述方法可能让你感到不适 hhh不过笔者发现一个奇淫技巧
#此脚本只适用Centos6/Centos7 64位系统
wget http://download.bt.cn/install/ext/ffmpeg.sh && sh ffmpeg.sh
#安装完后可输入以下命令是否安装成功
ffmpeg -version
缩略图功能
- 图片:
将 _h5ai
中,private
与 public
文件夹中的 cache
目录设置权限为 755
。
EXIF
:
直接用宝塔面板安装 PHP
,在 PHP
扩展选项里选择 Exif
模块安装
PDF
缩略图:
Ubuntu/Debian:
apt-get install imagemagick -y
CentOS:
yum install ImageMagick -y
如宝塔面板 PHP
扩展里找到 ImageMagick
安装
配置 Configuration
The main configuration file is . You might want to change some of the documented settings. But there are some more files in you might have a look at.\_h5ai/private/conf/options.json
_h5ai/private/conf
配置文件目录:_h5ai/private/conf/options.json
设置默认语言
在配置文件中搜索l10n
找到设置,将en
改为zh-cn
即可
"l10n": {
"enabled": true,
"lang": "zh-cn",
"useBrowserLang": true
},
开启文件搜索功能
在配置文件中搜索search
,将false
改为true
"search": {
"enabled": true,
"advanced": true,
"debounceTime": 300,
"ignorecase": true
},
多文件打包下载
在配置文件中搜索select
,将false
改为true
。之后你的h5ai
点击文件先端的时候,并不是下载,而是选中文件,下载的按钮呢在左上角喽。如果要下载文件呢,可以点击文件名字依旧还是下载功能
"select": {
"enabled": true,
"clickndrag": true,
"checkboxes": true
},
在配置文件中搜索download
,将false
改为true
,如果需要设置打包文件的格式为zip
,而不是默认的tar
的话,需要将php-tar
改为shell-zip
"download": {
"enabled": true,
"type": "shell-zip",
"packageName": null,
"alwaysVisible": false
},
二维码下载
可以通过扫码的方式下载文件。在配置文件中搜索info
,将false
改为true
,这里有 2 个地方要改
"info": {
"enabled": true,
"show": true,
"qrcode": true,
"qrFill": "#999",
"qrBack": "#fff"
},
当你鼠标置于文件上时,可以看见h5ai
右侧显示文件类型和二维码,手机扫码就可以下载文件
加密
首先生成自定义 sha512
密码:http://md5hashing.net/hashing/sha512
然后搜索 passhash
,大概第 10
行,将其密码改成自己生成的
其他
- 头部与底部说明
在需要显示自定义 HTML
的目录下,添加 _h5ai.headers.html
或_h5ai.footers.html
.通常用于对该目录的一些说明.支持 HTML
标签.
- 字体加速
h5ai 使用了谷歌字体,如有必要,可以更换谷歌字体镜像地址
打开文件目录:h5ai/private/conf/options.json,找到 resources 项,将 styles 参数中的 fonts.googleapis.com 替换为:
fonts.loli.net
参考:
https://larsjung.de/h5ai/
https://blog.iwyc.cn/h5ai
https://www.tok9.com/archives/374/
https://blog.csdn.net/ljianhui/article/details/23888269