过程:

安装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. Java工作流引擎 Activiti springmvc 后台框架源码 SSM 流程审批

    工作流模块----------------------------------------------------------------------------------------------- ...

  2. [转]图片压缩功能在JBoss AS7出错有关问题

    图片压缩功能在JBoss AS7出错问题近日在为平台(http://www.zyiqibook.com)做些小的整改,途中基本很顺利,但就在后面出现了些纠结的问题,而这问题我之前遇到过,因为一时没有想 ...

  3. MYSQL全文索引—CONTAINS语法

    我们通常在 WHERE 子句中使用 CONTAINS ,就象这样:SELECT * FROM table_name WHERE CONTAINS(fullText_column,'search con ...

  4. 第十二章 存储之 Secret

    1.Secret 存在意义 Secret 解决了密码.token.密钥等敏感数据的配置问题,而不需要把这些敏感数据暴露到镜像或者 Pod Spec中.Secret 可以以 Volume 或者环境变量的 ...

  5. go语言从例子开始之Example14.变参函数

    可变参数函数.可以用任意数量的参数调用.例如,fmt.Println 是一个常见的变参函数. Example: package main import "fmt" //...int ...

  6. SpringMvc获取前端的数据@RequestBody请求体/@PathVaribale/@RequestParam【支持Ajax】

    一.@RequestBody请求体 注意请求体只有form表单才有,而对于链接来说不使用 1).在Controller中写 @RequestBody String body是基本用法 另外可以封装对象 ...

  7. JS的加载和执行

    从JS的加载和执行谈性能优化 ---高性能JS读后感(第一章) 从脚本的"霸道"说起,随着浏览器的进步,js越来越听话了,所以,我们先说说以前的浏览器是怎么加载js的,以及js如何 ...

  8. Docker 镜像添加模块

    Docker 镜像添加模块   1. 使用root用户进入一个新容器,不要用 --rm .否则退出容器的时候,容器没有了 docker run --user 0 -it --name superman ...

  9. 【CSS】position(定位)属性

    关于CSS position,来自MDN的描述: CSS position属性用于指定一个元素在文档中的定位方式.top.right.bottom.left 属性则决定了该元素的最终位置. 然后来看看 ...

  10. windows 下安装python 的requests模块

    下载地址:https://codeload.github.com/requests/requests/legacy.zip/master 下载好后解压,进入目录执行下面命令 在cmd下:python ...