This example is part of this article.
This is an example for an HLS delivery with basic security. Nginx compiled with nginx-rtmp-module & secure-link is used as media server. Features:
- Domain filtering
- Referrer filtering
- Embed buster
| #!/bin/bash | |
| #https://gist.github.com/arenadoon/27fc93713c05a89bda5466e273137844 <--my | |
| #https://gist.github.com/Jekis/6c8fe9dfb999fa76479058e2d769ee5c <--Default | |
| function echo_mem_stat () { | |
| mem_total="$(free | grep 'Mem:' | awk '{print $2}')" | |
| free_mem="$(free | grep 'Mem:' | awk '{print $7}')" | |
| mem_percentage=$(($free_mem * 100 / $mem_total)) | |
| swap_total="$(free | grep 'Swap:' | awk '{print $2}')" |
This example is part of this article.
This is an example for an HLS delivery with basic security. Nginx compiled with nginx-rtmp-module & secure-link is used as media server. Features:
Three example nginx locations and the PHP required for mp4 secure_links.
before: https://https://mydomain.com/data/videos/file.mp4
after : https://mydomain.com/data/videos/file.mp4?md5=Vtzs2WCnCqRsE47EH6U6pQ&expires=1617601227
make sure the secret password you use match in both lines below
$remote_addr secretword << in nginx config section
| # Hard-code DNS resolver to Google's servers | |
| # | |
| # *Setup* | |
| # # download this file while DNS is working | |
| # curl https://gist.github.com/turadg/7876784/raw --output ~/google-resolv.conf | |
| # # replace your old DNS resolver | |
| # sudo cp /etc/resolv.conf /etc/resolv.conf.auto && sudo mv ~/google-resolv.conf /etc/resolv.conf | |
| # # make it uneditable so Vagrant doesn't clobber it | |
| # sudo chattr +i /etc/resolv.conf |
| # Criando um script .sh para executar todos os comandos: | |
| #root@servidor:~# vi script.sh | |
| #root@servidor:~# chmod +x script.sh | |
| #root@servidor:~# ./script.sh | |
| apt-get update | |
| apt-get -y install autoconf automake build-essential git-core libass-dev libgpac-dev libsdl1.2-dev libtheora-dev libtool libvdpau-dev libvorbis-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev libmp3lame-dev nasm gcc yasm && true | |
| mkdir ~/ffmpeg_sources | |
| cd ~/ffmpeg_sources | |
| git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git |
| # Criando um script .sh para executar todos os comandos: | |
| #root@servidor:~# vi script.sh | |
| #root@servidor:~# chmod +x script.sh | |
| #root@servidor:~# ./script.sh | |
| sudo yum groupinstall "Development Tools" | |
| sudo yum install -y yasm cmake libtool unzip wget | |
| apt-get update | |
| apt-get -y install autoconf automake build-essential git-core libass-dev libgpac-dev libsdl1.2-dev libtheora-dev libtool libvdpau-dev libvorbis-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev libmp3lame-dev nasm gcc yasm && true |
| #!/bin/sh | |
| echo '# ======================ของเซิฟตัวเล่น======================' >> /etc/sysctl.d/99-linux.internal.conf | |
| echo '# sysctl settings are defined through files in' >> /etc/sysctl.d/99-linux.internal.conf | |
| echo '# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.' >> /etc/sysctl.d/99-linux.internal.conf | |
| echo '#' >> /etc/sysctl.d/99-linux.internal.conf | |
| echo '# Vendors settings live in /usr/lib/sysctl.d/.' >> /etc/sysctl.d/99-linux.internal.conf | |
| echo '# To override a whole file, create a new file with the same in' >> /etc/sysctl.d/99-linux.internal.conf | |
| echo '# /etc/sysctl.d/ and put new settings there. To override' >> /etc/sysctl.d/99-linux.internal.conf | |
| echo '# only specific settings, add a file with a lexically later' >> /etc/sysctl.d/99-linux.internal.conf |
| #6.5.1 | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"> | |
| #5.15.4 | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"> | |
| #4.7 | |
| <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> |
| 17584) Chongqing Mobile Company (Chongqing, CN) | |
| 5726) China Unicom Chong Qing Branch (Chongqing, China) | |
| 5530) CCN (Chongqing, China) | |
| 19076) China Telecom (ChongQing, China) | |
| 20054) YunJinTianFu (Chengdu, China) | |
| 11444) University of Electronic Science and Technology of China (Chengdu, China) | |
| 2461) China Unicom (Chengdu, China) | |
| 4575) China Mobile Group Sichuan (Chengdu, China) | |
| 16398) China Mobile,GuiZhou (Guiyang, China) | |
| 5292) China Mobile Group Shaanxi Company Limited (Xi'an, China) |
| <?php | |
| /* | |
| Hi! | |
| So this gist is not a very good implementation, it works great in chrome but the seeking is sort of glitched in firefox. | |
| But it does the job and I hope it can help out! | |
| (Please let me know how to improve this) | |
| */ | |
| ini_set('max_execution_time', 0); | |
| $url = "http://mirrors.standaloneinstaller.com/video-sample/jellyfish-25-mbps-hd-hevc.m4v"; //just some sample url, please dont overload their servers |