rtube-online/nginx-rtmp/nginx.conf

74 lines
1.6 KiB
Nginx Configuration File

worker_processes auto;
rtmp_auto_push on;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record all;
record_path /recordings;
record_suffix -%Y-%m-%d-%H%M%S.flv;
record_unique on;
# Convert to HLS
hls on;
hls_path /hls;
hls_fragment 3;
hls_playlist_length 60;
hls_cleanup on;
# On stream end - trigger archive
# Use service name (Docker Compose DNS)
on_publish_done http://archive-worker:8081/archive;
# Allow publishing from anywhere (use stream key for security)
allow publish all;
allow play all;
}
}
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
# Docker internal DNS resolver
resolver 127.0.0.11 valid=30s ipv6=off;
server {
listen 8080;
# HLS playback
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
}
# Stream stats
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
# Simple status page
location / {
return 200 '{"status":"ok","service":"rtube-streaming"}';
add_header Content-Type application/json;
}
}
}