diff --git a/nginx/nginx.conf.template b/nginx/nginx.conf.template index 1a1e3c1..927089c 100644 --- a/nginx/nginx.conf.template +++ b/nginx/nginx.conf.template @@ -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/(?.+)/(?.+\.(?:m3u8|ts)) { + + location ~ /avalon/(?.+)/(?.+\.(?: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"; @@ -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; } @@ -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 { @@ -73,4 +81,4 @@ http { expires 24h; } } -} +} \ No newline at end of file diff --git a/nginx/nginx.sh b/nginx/nginx.sh index b61a0f3..71ac7c8 100644 --- a/nginx/nginx.sh +++ b/nginx/nginx.sh @@ -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