Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 25 additions & 17 deletions nginx/nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,45 @@ daemon off;
events {
worker_connections 1024;
}

http {
server {
listen $AVALON_STREAMING_PORT;

vod_mode local;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log debug;

vod_mode remote;
vod_upstream_location /s3;
vod_last_modified 'Sun, 19 Nov 2000 08:52:00 GMT';
vod_last_modified_types *;
vod_metadata_cache metadata_cache 512m;
vod_metadata_cache metadata_cache 1024m;
vod_response_cache response_cache 128m;
vod_hls_absolute_index_urls off;
vod_hls_absolute_master_urls off;

gzip on;
gzip_types application/vnd.apple.mpegurl;
# UMD Customization
vod_segments_base_url $AVALON_STREAMING_BASE_URL;
vod_base_url $AVALON_STREAMING_BASE_URL;
# End UMD Customization
open_file_cache max=1000 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;

location /status {
access_log off;
vod_status;
location /s3/avalon/ {
internal;
proxy_pass $AVALON_STREAMING_BUCKET_URL;
proxy_ssl_session_reuse on;
#proxy_set_header Host $http_host;
}
location ~ ^/avalon/(?<stream>.+)/(?<resource>.+\.(?:m3u8|ts)) {

location ~ /avalon/(?<stream>.+)/(?<resource>.+\.(?:m3u8|ts)) {
alias /data/$stream;
vod hls;
vod_mode local;
gzip on;
gzip_types application/x-mpegURL;

set $token "$arg_token";
add_header X-Stream-Auth-Token "$token";

sub_filter_types application/vnd.apple.mpegurl;
sub_filter_once off;
sub_filter '.ts' ".ts?token=$token";
Expand All @@ -49,7 +52,7 @@ http {
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 '*';
add_header Access-Control-Allow-Origin "*";
expires 100d;
}

Expand All @@ -59,6 +62,11 @@ http {
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
proxy_ssl_session_reuse on;
}

location /status {
vod_status;
}

location /crossdomain.xml {
Expand All @@ -73,4 +81,4 @@ http {
expires 24h;
}
}
}
}
4 changes: 2 additions & 2 deletions nginx/nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
export AVALON_DOMAIN
export AVALON_STREAMING_PORT
# UMD Customization
export AVALON_STREAMING_BASE_URL
envsubst '$AVALON_DOMAIN,$AVALON_STREAMING_PORT,$AVALON_STREAMING_BASE_URL' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
export AVALON_STREAMING_BUCKET_URL
envsubst '$AVALON_DOMAIN,$AVALON_STREAMING_PORT,$AVALON_STREAMING_BUCKET_URL' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
# End UMD Customization

exec /usr/local/nginx/sbin/nginx