-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnginx.conf
80 lines (60 loc) · 1.9 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
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
}
rtmp {
server {
listen 1935;
application app {
live on;
# No RTMP playback
deny play all;
# Push this stream to the local HLS packaging application
push rtmp://127.0.0.1:1935/hls-live;
# HTTP callback when a stream starts publishing
# Should return 2xx to allow, 3xx to redirect, anything else to deny.
on_publish http://127.0.0.1:3000/on_publish;
# Called when a stream stops publishing. Response is ignored.
on_publish_done http://127.0.0.1:3000/on_publish_done;
}
application hls-live {
live on;
# No RTMP playback
# deny play all;
# Only allow publishing from localhost
allow publish 127.0.0.1;
deny publish all;
# Package this stream as HLS
hls on;
hls_path /var/www/live;
# Put streams in their own subdirectory under `hls_path`
hls_nested on;
hls_fragment_naming system;
}
}
}
http {
server {
listen 8080;
root /var/www;
# Let streams be delivered via XHR.
# You'd also want to configure a `crossdomain.xml` file
# for Flash-based players.
add_header Access-Control-Allow-Origin "*";
add_header Access-Control-Allow-Methods "GET";
location ~ ^/live/(.+\.ts)$ {
alias /var/www/live/$1;
# Let the MPEG-TS video chunks be cacheable
expires max;
}
location ~ ^/live/(.+\.m3u8)$ {
alias /var/www/live/$1;
# The M3U8 playlists should not be cacheable
expires -1d;
}
}
}