SHARE
TWEET

Untitled

a guest Dec 21st, 2011 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. server {
  2.   listen 80;
  3.  
  4.   server_name smooth-streaming.example.org
  5.  
  6.   # document root...
  7.   root "/var/www/smooth";
  8.  
  9.   # turn off ngx_mod_smooth_streaming built-in
  10.   # rewrite engine (requires patch)
  11.   # patch URL: https://gist.github.com/1505787
  12.   ism_rewrite_engine off;
  13.  
  14.   ##########################################
  15.   #               REWRITES                 #
  16.   ##########################################
  17.   # manifest...
  18.   rewrite ^(.*/)?(.*)\.([is])sm/[Mm]anifest$ $1/$2.ismc last;
  19.  
  20.   # audio/video fetch rewrites...
  21.   rewrite ^(.*)\/+(\w+)\.([is]sml?)\/+QualityLevels\((\d+)\)\/+Fragments\((\w+)=(\d+)\) $1/$2.$3?bitrate=$4&$5=0&fragments_noun=Fragments&track_name=$5&time=$6 last;
  22.   ##########################################
  23.  
  24.   location ~ \.ism$ {
  25.     # we only accept get/head request methods
  26.     if ($request_method !~ ^(?:GET|HEAD)$) {
  27.       return 405;
  28.     }
  29.    
  30.     # check $args; there is a nasty BUG in libfmp4
  31.     # in function mp4_split_options_set()
  32.     # causing nginx worker to segfault unless
  33.     # this check is in place
  34.     if ($args !~ ^bitrate=\d+&(?:audio|video)=\d+.*&track_name=(?:\w+)&time=\d+$) {
  35.       return 400;
  36.     }
  37.  
  38.     # expires!!!
  39.     expires 2y;
  40.  
  41.     # activate mod_smooth_streaming
  42.     ism;
  43.   }
  44.  
  45.   ###################################################
  46.   #                    LOGGING                      #
  47.   ###################################################
  48.   access_log "/var/log/nginx/vhost-smooth.access" combined;
  49.   error_log "/var/log/nginx/vhost-smooth.error" warn;
  50.   ###################################################
  51. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top