-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnginx_rtmp_hls.conf
More file actions
61 lines (61 loc) · 1.76 KB
/
nginx_rtmp_hls.conf
File metadata and controls
61 lines (61 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
daemon off;
error_log logs/error.log;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935; # Listen on standard RTMP port
chunk_size 4000;
application show {
live on;
# Turn on HLS
hls on;
hls_path /opt/data/hls;
hls_fragment 5;
hls_playlist_length 50;
hls_keys on;
hls_key_path /opt/hls_keys;
hls_fragments_per_key 10;
# disable consuming the stream from nginx as rtmp
#allow play 127.0.0.1;
#allow play 192.168.1.10;
#deny play all;
}
}
}
http {
sendfile off;
tcp_nopush on;
#aio on;
directio 512;
default_type application/octet-stream;
server {
listen 80;
location / {
root /opt/data;
# Disable cache
add_header 'Cache-Control' 'no-cache';
# CORS setup
# to allow from specific domain uncomment this line and change domain
# add_header 'Access-Control-Allow-Origin' 'http://example.com' always;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';
# allow CORS preflight requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
types {
application/dash+xml mpd;
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
}
}
access_log off;
error_log off;
}