This repository was archived by the owner on Feb 12, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnginx.conf.j2
108 lines (81 loc) · 2.25 KB
/
nginx.conf.j2
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
96
97
98
99
100
101
102
103
104
105
106
107
108
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
chunk_size 4096;
# Initial receiver for streams, used for authentication.
application live {
# Receive live streams, but don't record them
live on;
record off;
# Stop anyone from playing the stream over RTMP
deny play all;
push rtmp://127.0.0.1:1935/hls-live;
# Push to other services
{% for item in streams %}
push rtmp://{{ item.url }}/{{ item.key }};
{% endfor %}
# Verify stream keys
on_publish http://127.0.0.1:8080/verify-stream;
on_publish_done http://127.0.0.1:8080/stream-over;
}
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 {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
root /var/www;
server_name localhost;
add_header Access-Control-Allow-Origin "*";
add_header Access-Control-Allow-Methods "GET";
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /var/www/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
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;
}
location /api/ {
proxy_pass http://localhost:8080/;
}
}
}