简洁美观的文件服务器 - h5ai 安装配置教程

温馨提示:
本文所述内容具有依赖性,可能因软硬条件不同而与预期有所差异,故请以实际为准,仅供参考。

一、简介

原文简介: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.

简单来说, h5ai 是一款 php 目录列表程序,也就是 php 列目录工具,支持 apache、nginx、lighttpd 等。

二、安装

1、安装依赖

h5ai 要求 php5.5+,使用 LAMP 或 LNMP 等一键安装包注意选择版本,如果有带 ImageMagick 插件注意也选上,预览会用到。

示例系统是 Ubuntu,并且未安装任何 LAMP 或 LNMP 等环境。已安装跳过这一步。

apt-get install mysql-server mysql-client \ 
apache2 \ 
php5 php5-cli libapache2-mod-php5 php5-mysql php5-curl \ 
php5-gd php-pear php5-imagick php5-mcrypt php5-memcache \ 
php5-mhash php5-sqlite php5-xmlrpc php5-xsl \ 
php5-json php5-dev libpcre3-dev

2、安装 h5ai

h5ai 下载即是管理器源码,直接解压到网站根目录即可。

wget https://release.larsjung.de/h5ai/h5ai-0.29.2.zip && unzip h5ai-0.29.2.zip

注意查看文件结构,正确的应是:

DOC_ROOT
 ├─ _h5ai
 ├─ your files
 └─ and folders

3、配置 h5ai

① 插件配置

浏览器输入 http://(YOUR-DOMAIN.TLD)/_h5ai/public/index.php,查看系统 h5ai 环境是否是否正常,若出现 false,根据需求安装依赖即可。

h5ai-2.jpg

一般需要额外安装的有 ImageMagick(预览图片),ffmpeglibav (预览视音频)等,具体安装方法可参考以下链接,其他的视需求安装:

I. Linux 安装 ffmpeg 方法
II.ImageMagick > 安装/配置

apt-get install libav-tools  #音视频
apt-get install aptitude     #图片/PDF
aptitude install imagemagick
apt-get install zip          #解压缩

CentOS 安装 ImageMagick:

yum install epel-release
yum install ImageMagick ImageMagick-devel

② apache 配置

将 /_h5ai/public/index.php 添加到 web 服务器配置文件中默认首页文件列表代码的最后位置

vim httpd.conf  #可以用 locate httpd.conf 找到文件位置
   DirectoryIndex  index.html  index.php  /_h5ai/public/index.php

nginx 配置类似。
正常安装后,文件放置到和 _h5ai 平级目录就可以,当然也可以建立文件夹等等。

③ 权限设置

分别修改 publicprivate 文件夹里的 cache 文件夹即可。

cd _h5ai
chmod 755 private/cache 
chmod 755 public/cache

④ 参数配置

配置文件是 _h5ai/private/conf/options.json
文件中对每一项参数的作用都说很清楚了,这里就不再赘述,按说明配置即可。

三、演示

2017-04-06_183456.png

四、类似应用

除了 h5ai 还有其他表现也还不错的目录程序,比如:

1、Apaxy
2、Directory Lister
3、pdirl
4、Directory Contents

具体表现可按关键字搜索。


参考文章:
1、h5ai modern HTTP web server index
2、搭建h5ai文件服务器
3、5款简单实用的免费目录列表程序(Directory Lister)演示及下载
4、win10家庭版列目录 h5ai + nginx + php


ArmxMod for Typecho
个性化、自适应、功能强大的响应式主题

推广

 继续浏览关于 h5ai文件管理 的文章

 本文最后更新于 2022/06/07 17:26:46,可能因经年累月而与现状有所差异

 引用转载请注明: VirCloud's Blog > 运维 > 简洁美观的文件服务器 - h5ai 安装配置教程

精选评论

  1. 文斯·欧
    文斯·欧 回复

    Windows 7Chrome 70.0.3538.77来自 福建 的大神

    安装在子目录的话,需要注意 index 要设置完整路径,否则子子目录会出现 403

  2. 范明明
    范明明 回复

    Windows 10Edge 18.18362来自 内蒙古 的大神

    两个cache文件夹给666权限以后,访问h5ai会报错。设置为755以后就正常了!
    很奇怪这个问题!

    1. 欧文斯

      文件夹必须给 X 的权限,不仅仅是 h5ai