icytv/nginx.example.conf

105 lines
2.5 KiB
Plaintext

worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
try_files $uri @distrib;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location /live/stat {
rtmp_stat all;
}
location /live {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin $http_origin;
}
location @distrib {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
# socket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://localhost:5000;
proxy_redirect off;
}
}
}
rtmp {
server {
listen 1935;
chunk_size 4096;
publish_time_fix off;
# Entry application
# The streamer publishes here through a streaming software with their key
# The authenticator will give the streamer a proper name on hls-live
application live {
# enable live streaming
live on;
record off;
allow play 127.0.0.1;
deny play all;
on_publish 'http://127.0.0.1:9321/publish';
on_publish_done 'http://127.0.0.1:9321/publish_done';
push rtmp://127.0.0.1:1935/hls-live;
}
# Output application
application hls-live {
# enable live streaming
live on;
allow publish 127.0.0.1;
deny publish all;
hls on;
hls_path /tmp/live;
hls_fragment 2s;
hls_cleanup on;
hls_sync 100ms;
hls_playlist_length 60;
}
}
}