Created
November 22, 2018 01:39
-
-
Save austinmccalley/188e42188d0406b9321d542018182886 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes auto; | |
error_log logs/error.log debug; | |
events { | |
worker_connections 1024; | |
} | |
# RTMP Config | |
rtmp { | |
server { | |
listen 1935; # Listen on standard RTMP port | |
ping 30s; | |
chunk_size 4000; | |
application live{ | |
live on; | |
deny play all; | |
push rtmp://localhost/play; | |
on_publish http://localhost:3001/api/on-live-auth; | |
on_publish_done http://localhost:3001/api/on-live-done; | |
} | |
application play { | |
live on; | |
# Turn on HLS | |
hls on; | |
hls_nested on; | |
hls_fragment_naming system; | |
#hls_path /Users/toan/Sites/mnt/hls/; | |
# hls_path /Users/toan/Tutorials/stream/storage/live/; | |
hls_path /Volumes/external/coding-streams/hls/live; | |
hls_fragment 3; | |
hls_playlist_length 60; | |
# disable consuming the stream from nginx as rtmp | |
deny play all; | |
#only allow from local | |
#only allow from local | |
allow publish 127.0.0.1; | |
deny publish all; | |
} | |
} | |
} | |
# End RTMP Config | |
http { | |
default_type application/octet-stream; | |
sendfile off; | |
tcp_nopush on; | |
server { | |
listen 3002; | |
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; | |
video/mp2t ts; | |
} | |
root /Volumes/external/coding-streams/hls/; | |
} | |
} | |
include servers/*; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment