worker_processes auto; error_log logs/error.log notice; working_directory /usr/local/nginx; events { worker_connections 1024; multi_accept on; } # Upstream publish for RTMPS stream { upstream publish { server 127.0.0.1:19361; #Redirect to rtmp server } server { listen 1935 ssl; # Port for publishing proxy_pass publish; ssl_certificate /tools/srm-streaming.crt; ssl_certificate_key /tools/srm-streaming.key; #allow 192.0.2.1; # allow publish from this IP #allow 192.0.2.0/24; # -- also supports CIDR notation! #deny all; # deny publish from the rest } #upstream live { # server 8080; #} #server { # listen 19351 ssl; # standard RTMP(S) port # proxy_pass live; # ssl_certificate /etc/letsencrypt/live/rtmp.example.com/fullchain.pem; # ssl_certificate_key /etc/letsencrypt/live/rtmp.example.com/privkey.pem; # allow all; # this is public (this is also the default) #} } # RTMP configuration rtmp { server { listen 127.0.0.1:19361; # Listen on standard RTMP port chunk_size 4000; application gmv { live on; meta copy; interleave on; # Turn on HLS hls on; hls_path /data/public/hls; #Path hls storage hls_fragment 2s; hls_playlist_length 24h; hls_continuous on; hls_nested on; hls_cleanup off; hls_fragment_naming timestamp; exec_publish_done bash -c "/data/generate_mp4_file_from_ts.sh $name"; #Script to convert to mp4 when publish done. ## Turn on DASH # dash on; # dash_path /data/dash; # dash_fragment 15s; # #Disable consuming the stream from nginx as rtmp #deny play all; #Para meter streamings antiguos en este #pull rtmp://ip:port/name/key name=tv2 static; #allow publish 127.0.0.1; # publishing through rtmps://rtmp.example.com:1936 } } server { listen 1936; # Listen on standard RTMP port chunk_size 4000; application gmv { live on; interleave on; # Turn on HLS hls on; hls_path /data/public/hls; #Path hls storage hls_fragment 2s; hls_playlist_length 24h; hls_continuous on; hls_nested on; hls_cleanup off; hls_fragment_naming timestamp; exec_publish_done bash -c "/data/generate_mp4_file_from_ts.sh $name"; #Script to convert to mp4 when publish done. ## Turn on DASH # dash on; # dash_path /data/dash; # dash_fragment 15s; # #Disable consuming the stream from nginx as rtmp #deny play all; #Para meter streamings antiguos en este #pull rtmp://ip:port/name/key name=tv2 static; #allow publish 127.0.0.1; # publishing through rtmps://rtmp.example.com:1936 } } } http { server { listen 8000; location / { root html; } location /publish/ { ts; ts_hls path=/data/public/hls segment=10s; #ts_dash path=/var/media/dash segment=10s; client_max_body_size 0; } location /play/ { types { application/x-mpegURL m3u8; application/dash+xml mpd; video/MP2T ts; video/mp4 mp4; } alias /data/public/; } } }