h5ai部署及坑

于由astupidcoder发布

h5ai是一个自动目录生成软件,功能类似nginx的autoindex on;实际用起来倍儿爽。
部署又简单,简直是送的。
官网如下:h5ai,h5ai下载链接
下载后解压到http的根目录即可。
需要安装php5及以上,nginx。
在域名服务商的DNS中添加一个二级域名,解析到IP,等能Ping通后申请一个Let’s Eycrypt的SSL证书,这个就不介绍了。
nginx配置如下:

server {
    listen 80;
    server_name         xyz.somesite.com;
    return 301 https://http_hostrequest_uri;
    server_tokens off;
}
server{
    listen 443 ssl;
    ssl on;
    ssl_certificate         /var/www/cert/yourcert.crt;
    ssl_certificate_key     /var/www/cert/yourkey.key;
    server_name             xyz.comesite.com;
    ssl_session_timeout 5m;
    ssl_session_cache shared:SSL:5m;

    ssl_protocols           TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers             HIGH:!aNULL:!MD5;

    server_tokens off;

    root /your/httproot/; #设置为_h5ai的父目录

    #index index.php index.html index.htm index.nginx-debian.html,/_h5ai/public/index.php; #如果你按这行设置,大概率一直看502
    index /_h5ai/public/index.php;


    # php-cgi,默认你已经配置好了
    location ~ \.php$ {
        include /etc/nginx/fastcgi.conf;
        include /etc/nginx/snippets/fastcgi-php.conf;
        fastcgi_intercept_errors on;
        fastcgi_pass   unix:/var/run/php5-fpm.sock;
    }
}

注意的是第20行,如果你index这么设置,可能会看到无限502,原因可能是同IP还配置了其他网站,也用到了index.php的缘故。
之后登陆
xyz.somesite.com/_h5ai/public/index.php
能看到还有哪些插件没有装,安装之即可。debian 8的源可能不直接有ffmpeg,可以

echo "deb http://www.deb-multimedia.org jessie main non-free" >> /etc/apt/sources.list
echo "deb-src http://www.deb-multimedia.org jessie main non-free" >> /etc/apt/sources.list
apt update
apt install deb-multimedia-keyring
apt update
apt install ffmpeg

之后打开xyz.somesite.com即可看到漂亮的前台。如下图:
h5ai
与_h5ai放在同一个目录下即可。
_h5ai和rclone挂载配合好像有点问题……郁闷。


0 条评论

发表回复

Avatar placeholder

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

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据。