Skip to content

Instantly share code, notes, and snippets.

@rickyngk
Created January 26, 2019 18:22
Show Gist options
  • Save rickyngk/1402c0650249db0a0b20d7878fecc786 to your computer and use it in GitHub Desktop.
Save rickyngk/1402c0650249db0a0b20d7878fecc786 to your computer and use it in GitHub Desktop.
OpenResty + Kaltura vod + Kaltura secure token | Nginx config local mode sample
worker_processes auto;
events {
use epoll;
}
http {
log_format main '$remote_addr $remote_user [$time_local] "$request" '
'$status "$http_referer" "$http_user_agent"';
access_log /dev/stdout main;
error_log /dev/stderr;
default_type application/octet-stream;
include /usr/local/openresty/nginx/conf/mime.types;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server {
root /opt/static;
# vod settings
vod_mode local;
vod_last_modified_types *;
# vod caches
vod_metadata_cache metadata_cache 512m;
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 /hls/ {
alias /opt/static/videos/;
vod hls;
vod_secret_key "mukkaukk$vod_filepath";
vod_hls_encryption_method aes-128;
set $token "token=123";
secure_token $token;
secure_token_types application/vnd.apple.mpegurl;
secure_token_expires_time 100d;
secure_token_query_token_expires_time 1h;
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;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment