Skip to content

Instantly share code, notes, and snippets.

@lvillarino
Created November 23, 2017 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lvillarino/c341b4cefc667dc616d64aa93538ee2d to your computer and use it in GitHub Desktop.
Save lvillarino/c341b4cefc667dc616d64aa93538ee2d to your computer and use it in GitHub Desktop.
nginx conf for nginx-vod-module on Ubuntu 16.04 with nginx secure_link_module
#user nobody;
worker_processes 1;
error_log logs/error.log;
error_log logs/error.log notice;
error_log logs/error.log info;
error_log logs/debug.log debug;
events {
worker_connections 1024;
}
http {
keepalive_timeout 65;
server {
index index.php index.html
# vod settings
vod_mode local;
vod_last_modified 'Sun, 19 Nov 2000 08:52:00 GMT';
vod_last_modified_types *;
# vod caches
vod_metadata_cache metadata_cache 32m;
vod_response_cache response_cache 128m;
# gzip manifests
gzip on;
gzip_types application/vnd.apple.mpegurl;
# file handle caching / aio
open_file_cache max=1000 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
aio on;
location /dash/ {
#secure_link $arg_md5,$arg_expires;
#secure_link_md5 "$secure_link_expires 12345";
#if ($secure_link = "") {
# return 403;
#}
#if ($secure_link = 0) {
# return 410;
#}
vod dash;
alias /usr/local/nginx/html/;
vod_segment_duration 4000;
vod_align_segments_to_key_frames on;
vod_manifest_duration_policy min;
vod_dash_manifest_format segmenttemplate;
vod_dash_profiles urn:mpeg:dash:profile:isoff-live:2011;
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
add_header Access-Control-Allow-Origin '*';
expires 100d;
}
location /hls/ {
#secure_link $arg_md5,$arg_expires;
#secure_link_md5 "$secure_link_expires 12345";
#if ($secure_link = "") {
# return 403;
#}
#if ($secure_link = 0) {
# return 410;
#}
vod hls;
alias /usr/local/nginx/html/;
vod_secret_key "mukkaukk$vod_filepath";
vod_hls_encryption_method aes-128;
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
add_header Access-Control-Allow-Origin '*';
expires 100d;
}
location /mp4/ {
secure_link $arg_md5,$arg_expires;
secure_link_md5 "$secure_link_expires 12345";
if ($secure_link = "") {
return 403;
}
if ($secure_link = 0) {
return 410;
}
vod none;
alias /usr/local/nginx/html/;
}
# vod status page
location /vod_status {
vod_status;
access_log off;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment