-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathnginx.conf
80 lines (61 loc) · 1.78 KB
/
nginx.conf
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
worker_processes auto;
events {
worker_connections 1024;
}
# RTMP Config
rtmp {
server {
listen 1935; # Listen on standard RTMP port
chunk_size 4000;
application live{
live on;
deny play all;
push rtmp://localhost/play;
on_publish http://localhost:3001/api/on-live-auth;
on_publish_done http://localhost:3001/api/on-live-done;
}
application play {
live on;
# Turn on HLS
hls on;
hls_nested on;
hls_fragment_naming system;
#hls_path /Users/toan/Sites/mnt/hls/;
hls_path /Users/toan/Tutorials/stream/storage/live/;
hls_fragment 3;
hls_playlist_length 60;
# disable consuming the stream from nginx as rtmp
#deny play all;
}
}
}
# End RTMP Config
http {
default_type application/octet-stream;
sendfile off;
tcp_nopush on;
server {
listen 3002;
location /live {
# Disable cache
add_header Cache-Control no-cache;
# CORS setup
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/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /Users/toan/Tutorials/stream/storage/;
}
}
include servers/*;
}