forked from bodnartibi/lcss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
95 lines (78 loc) · 2.53 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
}
http {
sendfile off;
tcp_nopush on;
directio 512;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
server {
listen 8080;
location ~ /[0-9]+/index\.m3u8 {
add_header Access-Control-Allow-Origin *;
add_header Cache-Control "public, no-transform";
expires 2s;
# 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;
}
root /mnt/records/nginx-rtmp-records/hls/;
}
location ~ /[0-9]+/[0-9]+\.ts$ {
expires 30s;
add_header Cache-Control "public, no-transform";
# CORS setup
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 {
video/mp2t ts;
}
root /mnt/records/nginx-rtmp-records/hls/;
}
}
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application show {
live on;
# Turn on HLS
hls on;
hls_continuous on;
hls_nested on;
hls_path /mnt/records/nginx-rtmp-records/hls/;
hls_fragment 2;
hls_playlist_length 10s;
# disable consuming the stream from nginx as rtmp
deny play all;
}
}
}