worker_processes 1; error_log logs/error.log debug; events { worker_connections 1024; } rtmp { server { listen 1935; allow play all; #creates our "live" full-resolution HLS videostream from our incoming encoder stream and tells where to put the HLS video manifest and video fragments application live { allow play all; live on; #record all; #record_path /video_recordings; #record_unique on; hls on; hls_nested on; hls_path /HLS/live; #hls_playlist_length 4s; #hls_fragment 1s; hls_fragment 10s; on_publish http://[YouPHPTubeURL]/plugin/Live/on_publish.php; on_play http://[YouPHPTubeURL]/plugin/Live/on_play.php; on_record_done http://[YouPHPTubeURL]/plugin/Live/on_record_done.php; } } } http { include mime.types; default_type application/octet-stream; server { listen 8080; server_name localhost; #creates the http-location for our full-resolution (desktop) HLS stream - "http://my-ip/live/my-stream-key/index.m3u8" location /live { # Disable cache add_header 'Cache-Control' 'no-cache'; # CORS setup add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Expose-Headers' 'Content-Length'; # allow CORS preflight requests if ($request_method = 'OPTIONS') { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Max-Age' 1728000; add_header 'Content-Type' 'text/plain charset=UTF-8'; add_header 'Content-Length' 0; return 204; } types { application/vnd.apple.mpegurl m3u8; } alias /HLS/live; } #allows us to see how stats on viewers on our Nginx site using a URL like: "http://my-ip/stats" #location /stats { # stub_status; #} location /stat { rtmp_stat all; rtmp_stat_stylesheet stat.xsl; } location /stat.xsl { root html; } location /control { rtmp_control all; } #allows us to host some webpages which can show our videos: "http://my-ip/my-page.html" location / { root html; index index.html index.htm; } } }