日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Nginx >内容正文

Nginx

Nginx模块学习之————accesskey权限模块使用(简单的m3u8防盗链)

發布時間:2024/2/28 Nginx 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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;} }

超強干貨來襲 云風專訪:近40年碼齡,通宵達旦的技術人生

總結

以上是生活随笔為你收集整理的Nginx模块学习之————accesskey权限模块使用(简单的m3u8防盗链)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。