当前位置: 首页 > 网站建设 > LNMP环境安装h5ai索引目录与基本配置

LNMP环境安装h5ai索引目录与基本配置

发布于:2017-11-2 网站建设 18条评论 20,033 views
本站提供Linux服务器运维,自动化脚本编写等服务,如有需要请联系博主微信:xiaozme

h5ai是一款PHP开发的索引目录程序,与之前介绍过的FdscriptPHP Directory Lister类似,从实际体验来看感觉h5ai功能更加丰富,于是小z将软件库更换到了h5ai,分享下配置过程。

在开始之前请先确保您已经安装了PHP环境,推荐使用OneinStack,如果是新手可以安装宝塔面板。

下载

官方下载地址:h5ai-0.29.0.zip
软件库下载:h5ai-0.29.0.zip
#在站点根目录执行
wget http://soft.xiaoz.org/website/h5ai-0.29.0.zip
unzip h5ai-0.29.0.zip

下载后解压至网站根目录,目录结构如下:

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

Nginx配置

接着访问http://YOUR-DOMAIN.TLD/_h5ai/public/index.php测试能否打开,如果正常应该会看到如下界面。

如果您安装的Oneinstack配置文件一般在/usr/local/nginx/conf/vhost/domain.com.conf,修改这个配置文件,将/_h5ai/public/index.php设置为默认首页,配置如下:

index index.html index.htm index.php /_h5ai/public/index.php;

修改后别忘记重载nginx(service nginx reload),如果不出意外,再次访问您的域名就可以看到效果了。

修改默认语言

h5ai支持多语言,但默认显示的是英文,可修改配置文件_h5ai/private/conf/options.json

"l10n": {
        "enabled": true,
        "lang": "en",
        "useBrowserLang": true
    },

en修改为zh-cn,这样默认就是中文界面啦。

"l10n": {
        "enabled": true,
        "lang": "zh-cn",
        "useBrowserLang": true
    },

开启搜索功能

依然是修改options.json这个文件,将

"search": {
        "enabled": false,
        "advanced": true,
        "debounceTime": 300,
        "ignorecase": true
    },

false修改为true就OK了

"search": {
        "enabled": true,
        "advanced": true,
        "debounceTime": 300,
        "ignorecase": true
    },

显示二维码

某些手机软件为了方便下载,可以开启二维码显示功能,直接用手机扫描下载,非常方便。修改options.json配置文件,

"info": {
        "enabled": false,
        "show": false,
        "qrcode": true,
        "qrFill": "#999",
        "qrBack": "#fff"
    },

false修改为true就OK了

"info": {
        "enabled": true,
        "show": true,
        "qrcode": true,
        "qrFill": "#999",
        "qrBack": "#fff"
    },

替换Google字体

这时候你会发现h5ai打开速度非常缓慢,原因是加载了Google字体导致,Google字体在墙内总是时灵时不灵的一会儿打得开一会儿打不开,干脆替换掉。修改options.json配置文件将fonts.googleapis.com替换为fonts.lug.ustc.edu.cn即可,替换后如下:

"resources": {
        "scripts": [],
        "styles": [
            "//fonts.lug.ustc.edu.cn/css?family=Ubuntu:300,400,700%7CUbuntu+Mono:400,700"
        ]
    },

总结

h5ai代码开源,并且还提供更多的配置项,功能丰富,体验了好几个索引目录程序,目前来说h5ai最令人满意,需要的功能都有,大家可以试试。

h5ai官网:https://larsjung.de/h5ai/
DEMO:http://soft.xiaoz.org/

回复 暴躁的女司机 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注


已有18条评论


    1. 感谢反馈,超级ping测了下中科大的字体CDN节点较少。看了下google字体源码css中还有嵌套css,弄到本地有点麻烦,后面我再看看有没有更好的方案。

  1. Warning: require_once(): open_basedir restriction in effect. File(/www/wwwroot/domain.com/_h5ai/private/php/class-bootstrap.php) is not within the allowed path(s): (/www/wwwroot/domain.com/_h5ai/public/:/tmp/:/proc/) in /www/wwwroot/domain.com/_h5ai/public/index.php on line 16

    Warning: require_once(/www/wwwroot/domain.com/_h5ai/private/php/class-bootstrap.php): failed to open stream: Operation not permitted in /www/wwwroot/domain.com/_h5ai/public/index.php on line 16

    Fatal error: require_once(): Failed opening required ‘/www/wwwroot/domain.com/_h5ai/public/../private/php/class-bootstrap.php’ (include_path=’.:/www/server/php/56/lib/php’) in /www/wwwroot/domain.com/_h5ai/public/index.php on line 16

    请问出现这样,怎么解决呀????