我们的故事

yuxiang2013@gmail.com

nginx autoindex 美化

接上篇文章《搭建接口文档和接口mock服务》,文中提到使用了nginx的autoindex作为接口文档库的http服务,很简陋。此文将介绍如何美化autoindex。

美化前


美化后


h5ai

今天的主角就是h5ai,官网地址:https://larsjung.de/h5ai/,demo地址:https://larsjung.de/h5ai/demo/ 。主要功能包括:美化文件列表、图片,文本预览、文件搜索、文件树形结构等。使用方法也很简单:

1. 下载h5ai软件包

    下载软件包,解压到autoindex根目录

2. 安装php,php-fpm(version5.5+)

    sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

   sudo rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

   sudo yum  install php56u php56u-fpm

   启动:sudo php-fpm    

3. 更新nginx配置

    3.1 添加index设置:index /_h5ai/public/index.php;

    3.2 添加php代理:   

        location ~ \.php$ {

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_param    SCRIPT_FILENAME  $document_root$fastcgi_script_name;

            include    fastcgi_params;

        }

4. 设置h5ai参数

    配置文件:_h5ai/private/conf/options.json

    4.1 替换google fonts地址

        把 //fonts.googleapis.com 替换为 //fonts.gmirror.org 即可 。

        服务提供方:Google Fonts 国内镜像加速(支持https)

    4.2 设置初始化的一些设置(可选)

        设置开启搜索,默认语言,视图等。

yuxiang2013@gmail.com

评论
热度(3)

© 我们的故事 | Powered by LOFTER