过程:

安装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. Centos7下编译安装php扩展redis5.0.2

    安装环境:centos7 + php 7.2.191. 下载地址:http://pecl.php.net/get/redis-5.0.2.tgz .tgz http://pecl.php.net/ge ...

  2. 深度学习之Tensorflow 工程化项目实战 配套资源

    https://www.aianaconda.com/index/CodeProject

  3. python安装pika模块rabbitmq

    1.pip install pika 2.如找不到 拷贝 D:\python\testmq\venv\Lib\site-packages  \pika目录

  4. vue 组件之间互相传值:兄弟组件通信

    vue 组件之间互相传值:兄弟组件通信我们在项目中经常会遇到兄弟组件通信的情况.在大型项目中我们可以通过引入 vuex 轻松管理各组件之间通信问题,但在一些小型的项目中,我们就没有必要去引入 vuex ...

  5. PHP基础知识------页面静态化

    1.在开发项目时,有时会遇到一些页面数据量特别大,但是又不经常改变的情况,如商城首页等,这时候就需要进行页面静态化,减轻服务器和数据库的压力. 这里我们先用原生的PHP写一个简单的demo,用来理解页 ...

  6. Delphi 访问https /SSL、OpenSSL

    访问 Web 网站,最简单用法直接使用 TIdHTTP 控件: 例如:AA := IdHTTP1.Get('www.baidu.com.'); 访问 https 的网站,需要 SSL 库. 在 Win ...

  7. nginx查看变量值

    nginx查看变量值 location / { echo $host; #域名 echo $remote_addr; echo $remote_user; echo $time_local; echo ...

  8. 20175203 2018-2019-2《Java程序设计》第四周学习总结

    ## 教材学习内容总结 第五章内容知识点总结: 子类父类的定义格式: class 子类名 extends 父类名 { } 定义子类时用extends Object类是所有类的祖先类,即最原始类. 子类 ...

  9. 《ArcGIS Runtime SDK for .Net开发笔记》--介绍与环境搭建

    一. ArcGIS Runtime SDK for .NET介绍 ArcGIS Runtime SDK for .net是一款针对windows平台的开发包.能够在开发出在windows phone, ...

  10. uuid 去中心化的唯一性

    A Universally Unique IDentifier (UUID) URN Namespace https://tools.ietf.org/html/rfc4122.html A UUID ...