66 lines
1.5 KiB
Nginx Configuration File
66 lines
1.5 KiB
Nginx Configuration File
worker_processes auto;
|
|
rtmp_auto_push on;
|
|
events {}
|
|
|
|
rtmp {
|
|
server {
|
|
listen 1935;
|
|
listen [::]:1935 ipv6only=on;
|
|
|
|
application live {
|
|
live on;
|
|
record off;
|
|
|
|
# HLS Configuration
|
|
hls on;
|
|
hls_path /tmp/hls;
|
|
hls_fragment 2s;
|
|
hls_playlist_length 10s;
|
|
|
|
# HLS variants for different qualities
|
|
hls_variant _low BANDWIDTH=500000;
|
|
hls_variant _mid BANDWIDTH=1500000;
|
|
hls_variant _high BANDWIDTH=3000000;
|
|
|
|
# Allow publishing from local network
|
|
allow publish 127.0.0.1;
|
|
allow publish 172.16.0.0/12;
|
|
deny publish all;
|
|
|
|
# Allow playing from anywhere
|
|
allow play all;
|
|
|
|
# Execute script on stream publish/done
|
|
exec_publish /usr/local/bin/on_publish.sh $name;
|
|
exec_publish_done /usr/local/bin/on_publish_done.sh $name;
|
|
}
|
|
}
|
|
}
|
|
|
|
http {
|
|
server {
|
|
listen 8080;
|
|
|
|
# Serve HLS fragments
|
|
location /hls {
|
|
types {
|
|
application/vnd.apple.mpegurl m3u8;
|
|
video/mp2t ts;
|
|
}
|
|
root /tmp;
|
|
add_header Cache-Control no-cache;
|
|
add_header Access-Control-Allow-Origin *;
|
|
}
|
|
|
|
# Status page
|
|
location /stat {
|
|
rtmp_stat all;
|
|
rtmp_stat_stylesheet stat.xsl;
|
|
}
|
|
|
|
location /stat.xsl {
|
|
root /usr/local/nginx/html;
|
|
}
|
|
}
|
|
}
|