过程:

安装php-fpm和nginx,且经验证二者在其他项目可以正常使用。

从debian8拷贝过来_h5ai的nginx配置如下:

     location ~ [^/]\.php(/|$) {
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; #反注释
include /etc/nginx/snippets/fastcgi-php.conf;
}

由于centos7服务器上没有/etc/nginx/snippets/fastcgi-php.conf这个文件,所以把这行改成了include fastcgi_params;,即:

# _h5ai file server
server {
listen 12345;
# server_name _;
root /home/chudongyu/rtorrent/download;
index index.html index.php /_h5ai/public/index.php; location / {
try_files $uri $uri/ /index.php$is_args$args;
} location ~ [^/]\.php(/|$) {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
}
}

但是_h5ai并不能用,症状:

打开172.19.240.132:12345,只有空白页面,不显示任何东西。检查nginx的日志里面完全正常,没有错误。

在文件夹下建立index.html,发现可以显示,但是建立index.php()还是一批空白,啥都没有。

折腾良久,最终发现仅仅include fastcgi_params'是不够的,还要添加:

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

完整的正确配置如下

# _h5ai file server
server {
listen 12345;
# server_name _;
root /home/chudongyu/rtorrent/download;
index index.html index.php /_h5ai/public/index.php; location / {
try_files $uri $uri/ /index.php$is_args$args;
} # location ~ [^/]\.php(/|$) {
# fastcgi_pass 127.0.0.1:9000;
# include fastcgi_params;
# } location ~ \.php$ {
root /home/chudongyu/rtorrent/download;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

参考:https://blog.csdn.net/zsx0728/article/details/81183056

一个视频播放器更好用的_h5ai修改版:

【自用分享】 h5ai HTML5播放器(DPlayer)版

https://www.hostloc.com/thread-438265-1-2.html

直接下载地址: https://www.moerats.com/usr/down/h5ai_dplayer+modified+by+icycat.zip

另一种配置(在其他端口使用/download/路径,如xxx:8080/download/):

.......
location ~ /download(/|$) {
root /home/chudongyu/rtorrent;
index index.html index.php /download/_h5ai/public/index.php;
try_files $uri $uri/ /index.php$is_args$args; # #NOT WORK:
# root /home/chudongyu/rtorrent/download;
# index index.html index.php /_h5ai/public/index.php;
# try_files $document_root $document_root/ /index.php$is_args$args; # $real_script为空的时候,还是回访问download/download...
# # try_files index.html /_h5ai/public/index.php;
# # fastcgi_pass 127.0.0.1:9000;
# # fastcgi_index /_h5ai/public/index.php;
# # fastcgi_param SCRIPT_FILENAME $document_root;
# # include fastcgi_params;
}
location ~ /download/\.php$ {
root /home/chudongyu/rtorrent/download;
index index.html index.php /_h5ai/public/index.php;
# return 200 '$fastcgi_script_name'; # 返回的是 /download/...
set $real_script '';
if ( $fastcgi_script_name ~ /download(.*) ){ # 根据location的匹配规则,$1不会为空
set $real_script $1;
}
# return 200 $real_script;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$real_script;
include fastcgi_params;
}
.......
}

在云服务器搭了个下载器从紫荆下电影。。。



centos7上的h5ai折腾记的更多相关文章

  1. 【转载】有图 KVM折腾记..

    KVM折腾记...https://lengjibo.github.io/KVM%E6%8A%98%E8%85%BE%E8%AE%B0/  Veröffentlicht am 2018-09-20 |  ...

  2. 斐讯N1折腾记

    斐讯N1折腾记:运行 Linux 及优化  2018-06-23  37条评论  4,445次阅读  11人点赞 最后更新时间:2019年03月10日 咳咳咳,上篇教程教大家给斐讯 N1 降级并且刷了 ...

  3. Atom编辑器折腾记

    http://blog.csdn.net/bomess/article/category/3202419/2 Atom编辑器折腾记_(1)介绍下载安装 Atom编辑器折腾记_(2)基础了解使用 Ato ...

  4. 在CentOS7上部署PostgreSQL11数据库系统

    在数据库上的选择,也是基于了稳定性为前提.其实选择的范围并不是太大,基本可以选择的范围也就是SQLServer.MySQL.PostgreSQL这三种.SQL Server是微软的商业数据库,无论是性 ...

  5. BeagleBone折腾记(一):连接你的狗板

    BeagleBone折腾记一连接你的狗板 准备 了解BeagleBone BeagleBone社区 所需软硬件 USB连接 TTL连接 结语 准备 了解BeagleBone BeagleBone可能一 ...

  6. Anaconda折腾记(1)

    Anaconda折腾记 谨此记录小白的我在Anaconda里面的摸爬滚打 更换更新源 可以不使用命令,直接进入C盘,进入user文件夹,进入当前的用户文件夹下,记得显示隐藏文件. 找到.condarc ...

  7. hbase2.1.9 centos7 完全分布式 搭建随记

    hbase2.1.9 centos7 完全分布式 搭建随记 这里是当初在三个ECS节点上搭建hadoop+zookeeper+hbase+solr的主要步骤,文章内容未经过润色,请参考的同学搭配其他博 ...

  8. zookeeper3.5.5 centos7 完全分布式 搭建随记

    zookeeper3.5.5 centos7 完全分布式 搭建随记 这里是当初在三个ECS节点上搭建hadoop+zookeeper+hbase+solr的主要步骤,文章内容未经过润色,请参考的同学搭 ...

  9. 在centos7上安装Jenkins

    在centos7上安装Jenkins 安装 添加yum repos,然后安装 sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins ...

随机推荐

  1. Mac 安装cnpm

    1.先安装node   node的下载地址:http://nodejs.cn/download/   这个没什么好说的,安装完成后测试一下,在终端输入:node -v   这时候就可以看到安装的nod ...

  2. 回收子进程——wait/waitpid 与 信号机制

    孤儿/僵尸进程——回收子进程 参考博客:https://blog.csdn.net/qq_35396127/article/details/78725915 :https://www.cnblogs. ...

  3. 图解SSH原理_20190613

    SSH仅仅是一协议标准,其具体的实现有很多,既有开源实现的OpenSSH,也有商业实现方案.使用范围最广泛的当然是开源实现OpenSSH. 2. SSH工作原理 在讨论SSH的原理和使用前,我们需要分 ...

  4. mqtt发送消息,消息体为16进制

    在idea 加入代码  :-server -XX:PermSize=256M -XX:MaxPermSize=256M -Dfile.encoding=UTF-8

  5. 字符串操作——C语言实现

    代码如下: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <asse ...

  6. jquery submit事件

    jquery submit 事件 $('#form').submit(function(){ if(true){ //do return true; }else{ //do return false; ...

  7. Spring Boot和Spring Cloud学习资源推荐

    Spring Boot和Spring Cloud学习资源推荐   比较好的学习资源,分享一下. 1.Spring Boot官方文档:http://projects.spring.io/spring-b ...

  8. 【leetcode】995. Minimum Number of K Consecutive Bit Flips

    题目如下: In an array A containing only 0s and 1s, a K-bit flip consists of choosing a (contiguous) suba ...

  9. FastDFSClient上传图片工具类

    package cn.lijun.core.util; import org.apache.commons.io.FilenameUtils;import org.csource.common.Nam ...

  10. PHP disk_free_space() 函数

    定义和用法 disk_free_space() 函数返回指定目录的可用空间,以字节为单位. 语法 disk_free_space(directory) 参数 描述 directory 必需.规定要检查 ...