Created
November 12, 2018 23:43
-
-
Save austinmccalley/1fbfcd81850061977c1853154f2a4086 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 warn; | |
| events { | |
| worker_connections 1024; | |
| } | |
| # RTMP Config | |
| rtmp { | |
| server { | |
| listen 1935; # Listen on standard RTMP port | |
| 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 | |
| # allow publish 127.0.0.1; | |
| allow publish all; | |
| 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