前言

前几个月就发现了这个程序,自认为很美观,自带预览功能
apache/nginx的默认index 外观实在不咋地,而且不能预览,搭建文件分享站或镜像站颜值少了不少,h5ai占用少而且颜值很高,有点很多,语言是php的
我自己也用h5ai搭建了一些小站

教程分类

官网:https://larsjung.de/h5ai/ (源码在这下,github上只是基本源码)
GITHUB开源:https://github.com/lrsjng/h5ai
以下教程分两种

  • 我已经包装好只要复制一下源码 (最简单,适合小白啥也不懂,已经封装dplayer等基本插件)》》极简安装
  • 一切自己安装,官方步骤 (一切原生)》》官方安装

极简安装

这里列出宝塔安装步骤
1.安装宝塔 https://bt.cn
2.安装完后安装 PHP 5.5以上版本 nginx 解析域名
3.在php拓展中安装fileinfo,imagemagick,exif 如图
TIM截图20200704132555.png
4.在禁用函数里找到putenv 删除
TIM截图20200704132942.png
5.下载源码到网站目录
https://mir.lolinet.cn/mir/mir.zip
解压出现 _h5ai文件夹
TIM截图20200704133126.png
文件放置结构为如下

 ├─ _h5ai

 ├─ your files

 └─ and folders

像上图为例子
6.在网站默认文档中添加 /_h5ai/public/index.php
7.打开网页即可看到程序已经安装成功,只要在根目录上传文件或者创建文件夹都可以显示
TIM截图20200704133536.png

官方安装

1.下载源码到根目录
https://larsjung.de/h5ai/
解压,将文件夹改名为_h5ai
2.安装 php5.5以上的php
3.在php拓展中安装fileinfo,imagemagick,exif 如图
TIM截图20200704132555.png
4.在禁用函数里找到putenv 删除
TIM截图20200704132942.png
5.尝试访问网站是否可以访问 http://xxxx.xxx/_h5ai/public/index.php
正常如下:
TIM截图20200704134328.png
如果没在 _h5ai/private/conf/options.json设置密码,直接点击login跳转
这时有环境检测 我的如下
h5ai version 0.29.2
Only green if this is an official h5ai release
Index file found yes
Add /_h5ai/public/index.php to your index file list
Options parsable yes
File options.json is readable and syntax is correct
Types parsable yes
File types.json is readable and syntax is correct
Server software nginx 1.16.1
Server is one of apache, lighttpd, nginx or cherokee
PHP version 7.2.31
PHP version >= 5.5.0
PHP arch 64-bit
64-bit required to correctly display file/folder sizes > ~2GB
Public Cache directory yes
Web server has write access
Private Cache directory yes
Web server has write access
Image thumbs yes
PHP GD extension with JPEG support available
Use EXIF thumbs yes
PHP EXIF extension available
Movie thumbs no
Command line program avconv or ffmpeg available
PDF thumbs yes
Command line program convert or gm available
Shell tar yes
Command line program tar available
Shell zip yes
Command line program zip available
Shell du yes
Command line program du available
这时需要安装 ffmpeg
安装ffmpeg方法 (3.4.2版本)

wget http://www.ffmpeg.org/releases/ffmpeg-3.4.2.tar.gz

tar -zxvf ffmpeg-3.4.2.tar.gz

cd ffmpeg-3.4.2

./configure

make

make install

安装过程中如果出现如下错误:
yasm/nasm not found or too old. Use –disable-yasm for a crippled build.
这时需要安装yasm,安装如下

wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz

tar -zxvf yasm-1.3.0.tar.gz

cd yasm-1.3.0

./configure

make

make install

所有安装完基本就成功了(时间较久)
安装视频

TIM截图20200704140953.png
TIM截图20200704141223.png
6.在网站默认文档中添加 /_h5ai/public/index.php
7.访问网站已经成功了
结构目录如下

 ├─ _h5ai

 ├─ your files

 └─ and folders