Nginx模块学习之————accesskey权限模块使用(简单的m3u8防盗链)
配置文件:http://www.cnblogs.com/tinywan/p/5983694.html
通过加密后的文件:
正确地址:curl -i http://访问的IP地址(这里是直播节点IP地址)/hls/S0000_8.m3u8?key=c7e2d8f498920f1a86e4c95d4a58a27e
参数错误地址:curl -i http://访问的IP地址(这里是直播节点IP地址)/hls/S0000_8.m3u8?key=c7e2d8f498920f1a86e4c95d4a58a27123213
没带参数:curl -i http://访问的IP地址(这里是直播节点IP地址)/hls/S0000_8.m3u8
【1】正确地址: curl -i http://访问的IP地址(这里是直播节点IP地址)/hls/S0000_8.m3u8?key=c7e2d8f498920f1a86e4c95d4a58a27e
www@iZ23a7607jaZ:/home/tinywan$ curl -i http://访问的IP地址(这里是直播节点IP地址)/hls/S0000_8.m3u8?key=c7e2d8f498920f1a86e4c95d4a58a27e
HTTP/1.1 200 OK
Server: nginx/1.8.1
Date: Fri, 21 Oct 2016 09:12:39 GMT
Content-Type: application/vnd.apple.mpegurl
Content-Length: 367
Last-Modified: Fri, 21 Oct 2016 09:12:34 GMT
Connection: keep-alive
ETag: "5809dc02-16f"
Cache-Control: no-cache
Access-Control-Allow-Origin: *
Accept-Ranges: bytes #EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:300
#EXT-X-TARGETDURATION:7
#EXT-X-KEY:METHOD=AES-128,URI="https://myserver.com/keys/S0000_8-300.key",IV=0x0000000000000000000000000000012C
#EXTINF:7.000,
S0000_8-300.ts
#EXTINF:7.000,
S0000_8-301.ts
#EXTINF:7.000,
【2】参数错误地址:curl -i http://访问的IP地址(这里是直播节点IP地址)/hls/S0000_8.m3u8?key=c7e2d8f498920f1a86e4c95d4a58a27123213
www@iZ23a7607jaZ:/home/tinywan$ curl -i http://访问的IP地址(这里是直播节点IP地址)/hls/S0000_8.m3u8?key=c7e2d8f498920f1a86e4c95d4a58a27123213
HTTP/1.1 403 Forbidden
Server: nginx/1.8.1
Date: Fri, 21 Oct 2016 09:14:30 GMT
Content-Type: text/html
Content-Length: 168
Connection: keep-alive <html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.8.1</center>
</body>
</html>
【3】没有携带参数访问:curl -i http://访问的IP地址(这里是直播节点IP地址)/hls/S0000_8.m3u8
www@iZ23a7607jaZ:/home/tinywan$ curl -i http://访问的IP地址(这里是直播节点IP地址)/hls/S0000_8.m3u8
HTTP/1.1 403 Forbidden
Server: nginx/1.8.1
Date: Fri, 21 Oct 2016 09:15:15 GMT
Content-Type: text/html
Content-Length: 168
Connection: keep-alive <html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.8.1</center>
</body>
</html>
www@iZ23a7607jaZ:/home/tinywan$
【4】Nginx config配置文件:
http {
include mime.types;
default_type application/octet-stream;
log_format main '[$time_local][$remote_addr][$http_x_forwarded_for] $status "$request" "$http_referer" "$http_user_agent"';
access_log logs/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 443 ssl;
server_name example.com;
#ssl_certificate /var/ssl/example.com.cert;
#ssl_certificate_key /var/ssl/example.com.key;
location /keys {
root /tmp;
}
}
server {
set $wwwroot /home/www/node/html;
listen 80;
server_name 127.0.0.1;
index index.html;
root $wwwroot;
access_log logs/node.access.log main;
location /rtmp/stat {
rtmp_stat all;
rtmp_stat_stylesheet rtmpstat.xsl;
}
location /rtmpstat.xsl {
}
location /rtmp/control {
rtmp_control all;
}
location ~* /hls/.*\.m3u8$ {
types {
application/vnd.apple.mpegurl m3u8;
}
root /tmp;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
accesskey on;
accesskey_hashmethod md5;
accesskey_arg "key";
#accesskey_signature "password$remote_addr";
accesskey_signature "password120.26.206.180";
}
location ~* /hls/.*\.ts$ {
types {
video/mp2t ts;
}
root /tmp;
expires 1m;
add_header Cache-Control public;
add_header Access-Control-Allow-Origin *;
}
#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location /hls {
accesskey on;
accesskey_hashmethod md5;
accesskey_arg "key";
accesskey_signature "password$remote_addr";
#accesskey_signature "password115.29.201.161";
alias /tmp/hls;
}
location /control {
rtmp_control all;
}
}
}
rtmp {
server {
listen 1935;
ping 30s;
notify_method get;
drop_idle_publisher 3s;
application live {
live on;
#pull rtmp://121.40.133.183/live/206 name=206;
#exec /home/www/bin/rtmpHLS.sh $name;
exec /home/www/bin/autoRecord.sh $name;
exec_kill_signal term;
#exec_play /home/www/bin/execPlay.sh $name;
#on_play http://sewise.amai8.com/authcheck/play;
#录像模块
recorder rec1 {
record all manual;
record_unique on;
record_notify on;
record_max_size 512M;
#record_interval 30s;
record_path /data/recorded_flvs;
record_suffix all.flv;
#录像停止后,先判断是否能上传,允许后则将录像上传到OSS/
exec_record_done /home/www/bin/rtmpRecorded.sh $name $path $filename $basename $dirname;
}
}
hls on;
hls_path /tmp/hls;
#hls_sync 100ms;
hls_keys on;
#hls_key_path /tmp/keys;
hls_key_url https://myserver.com/keys/;
hls_fragments_per_key 10;
}
}
Nginx模块学习之————accesskey权限模块使用(简单的m3u8防盗链)的更多相关文章
- Nginx模块学习之————accesskey权限模块使用(Nginx防盗链详细解说),防止别人下载文件和图片
nginx 的第三方模块ngx_http_accesskey_module 来实现下载文件的防盗链 1.具体安装教程:http://www.cnblogs.com/tinywan/p/5983694. ...
- Python3 学习第九弹: 模块学习二之文件管理模块
os模块 提供访问操作系统的接口 1> name 获得当前操作系统 其中 'nt' 是 windows 'posix' 是 linux 2> environ 获得当前系统的环境变量的字典, ...
- Scikit-Learn模块学习笔记——数据预处理模块preprocessing
preprocessing 模块提供了数据预处理函数和预处理类,预处理类主要是为了方便添加到 pipeline 过程中. 数据标准化 标准化预处理函数: preprocessing.scale(X, ...
- scikit-learn模块学习笔记(数据预处理模块preprocessing)
本篇文章主要简单介绍sklearn中的数据预处理preprocessing模块,它可以对数据进行标准化.preprocessing 模块提供了数据预处理函数和预处理类,预处理类主要是为了方便添加到pi ...
- 【Python】模块学习之利用string模块造测试数据
背景 测试过程中需要一些随机数据,使用到了python中的string模块,记录一下 #! /usr/bin/python # coding:utf-8 """ @aut ...
- Python3 学习第十四弹: 模块学习六之re模块 + 正则表达式 (转)
本文转自 AstralWind 的博客:Python正则表达式指南 特来收藏 1. 正则表达式基础 1.1. 简单介绍 正则表达式并不是Python的一部分.正则表达式是用于处理字符串的强大工具,拥有 ...
- Redis模块学习笔记(一)RediSearch简单使用
说明:安装的Redis服务器必须为 4.0 以上版本,通过info命令查看 > INFO redis_version: 一.安装 RediSearch git clone https://git ...
- springboot + shiro 构建权限模块
权限模块基本流程 权限模块的基本流程:用户申请账号和权限 -->登陆认证 -->安全管控模块认证 -->调用具体权限模块(基于角色的权限控制) --> 登陆成功 -->访 ...
- nginx之rewrite及防盗链
rewrite示例-自动跳转https 示例1:自动把首页的http转化成https location / { root /data/nginx/pc/html; index index.html; ...
随机推荐
- [转]Windows配置Git
原文地址:http://blog.csdn.net/exlsunshine/article/details/18939329 1.从git官网下载windows版本的git:http://git-sc ...
- NIOS II CPU复位异常的原因及解决方案
NIOS II CPU复位异常的原因及解决方案 近期在用nios ii做项目时,发现一个奇怪的现象,在NIOS II EDS软件中编写好的代码,烧写到芯片中,第一次能够正常运行,但是当我按下板卡上 ...
- Sqoop安装及操作
一.集群环境: Hostname IP Hadoop版本 Hadoop 功能 系统 node1 192.168.1.151 0.20.0 namenode hive+sqoop rhel5.4X86 ...
- js闭包的产生
当函数可以记住并访问所在的词法作用域, 即函数是在当前词法作用域之外执行, 这时就产生了闭包. function a () { function b () { //函数b的词法作用域是在函数a内 ...
- System.exit(0)和System.exit(1)区别:
System.exit(0)是将你的整个虚拟机里的内容都停掉了,而finish()只是退出了activity,并没有退出应用,Application还是存在于内存中的,除非被系统回收.无论如何,内存都 ...
- 每日一九度之 题目1031:xxx定律
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6870 解决:4302 题目描述: 对于一个数n,如果是偶数,就把n砍掉一半:如果是奇数,把n变成 3*n+ 1后砍掉一半,直到该数 ...
- 【转】MYSQL入门学习之四:MYSQL的数据类型
转载地址:http://www.2cto.com/database/201212/175536.html 一.整型 www.2cto.com 整数类型是数据库中最基本的数据类型 ...
- SqlServer性能优化和工具Profiler(转)
合理的优化和熟练的运用Profiler会让你更好的掌握系统的sql语句和存储过程的效率 目录 第1章 如何打开SQL Server Profile. 3 第2章 SQL Server Profile. ...
- 文件映射mmap
磁盘与内存的映射就是文件映射,说这个问题之前我们先说下swap,因为 这个问题让我很容易想起swap,linux swap 是交换分区的意思,在内存不 够的情况下,操作系统先把内存与磁盘的sw ...
- Camera 图像处理原理分析
1 前言 做为拍照手机的核心模块之一,camera sensor效果的调整,涉及到众多的参数,如果对基本的光学原理及sensor软/硬件对图像处理的原理能有深入的理解和把握的话,对我们 ...