Skip to content

Instantly share code, notes, and snippets.

@ryanbekabe
Created October 10, 2021 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanbekabe/79f4303e2669dcdcc25aa33753022e71 to your computer and use it in GitHub Desktop.
Save ryanbekabe/79f4303e2669dcdcc25aa33753022e71 to your computer and use it in GitHub Desktop.
Nginx RTMP Configuration Store HLS to Web with chmod and chown 777 root
#hanyajasa.com 10/10/2021
#https://youtu.be/I8beTf8PiBs
#Live Streaming OBS ke VPS Nginx RTMP, Play via Browser
worker_processes 1;
events {
worker_connections 1024;
}
http {
access_log /var/log/nginx/access-streaming.log;
error_log /var/log/nginx/error-streaming.log;
default_type application/octet-stream;
server {
listen 81;
location /tv {
root /tmp/dash;
}
#location /stats {
# rtmp_stat all;
#}
#location /control {
# rtmp_control all;
#}
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
# XML stylesheet to view RTMP stats.
# Copy stat.xsl wherever you want
# and put the full directory path here
root /usr/local/nginx/html;
}
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
#text/html html;
}
#root /tmp/hls;
root /usr/local/nginx/html;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
}
location /dash {
#root /tmp/dash;
root /usr/local/nginx/html;
add_header Cache-Control no-cache;
}
}
#types {
# application/vnd.apple.mpegurl m3u8;
# video/mp2t ts;
# text/html html;
# #application/dash+xml mpd;
#}
}
rtmp {
server {
listen 1935;
#chunk_size 4000;
application live {
live on;
#dash on;
hls on;
#dash_path /tmp/dash;
#hls_path /tmp/hls;
hls_path /usr/local/nginx/html;
#http://juli.my.id:81/movie/index.m3u8
#dash_fragment 15s;
hls_fragment 15s;
#meta copy;
#hls_cleanup off;
hls_nested on;
#record all;
#record_path /usr/local/nginx/html;
#record_max_size 1k;
#record_unique on;
#record_suffix %y%m%d_%H%M%S.flv;
#push rtmp://a.rtmp.youtube.com/live2/su4w-rpbh-tvwv-vg2k-21zq;
exec_options on;
exec chmod -R 777 /usr/local/nginx/html;
exec chown -R root:root /usr/local/nginx/html;
}
#application hls {
# live on;
# hls on;
# hls_path /var/www/html/lab/hls;
#}
#application dash {
# live on;
# dash on;
# dash_path /usr/local/nginx/html/dash;
#}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment