-
Notifications
You must be signed in to change notification settings - Fork 2
/
nginx.conf
58 lines (48 loc) · 1.59 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
user nobody;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 20480;
}
http {
include mime.types;
proxy_temp_path /dev/shm/tmp 1;
proxy_cache_path /dev/shm/hls_cache/ levels=1:2 keys_zone=hls-cache:100m inactive=2m max_size=3g;
proxy_cache_path /dev/shm/m3u8_cache/ levels=1:2 keys_zone=m3u8-cache:1m inactive=5s max_size=10m;
proxy_cache_lock on;
server {
listen 80;
listen [::]:80;
client_body_buffer_size 256M;
client_max_body_size 256M;
proxy_buffering on;
proxy_buffer_size 10M;
proxy_buffers 20 10M;
proxy_busy_buffers_size 20M;
location ~ \.ts$ {
access_log /var/log/nginx-access-ts.log;
error_log /var/log/nginx-error-ts.log;
proxy_ignore_headers Cache-Control Expires;
proxy_pass http://[视频源地址]$uri;
proxy_cache hls-cache;
proxy_cache_key $host$uri;
proxy_cache_valid 200 304 2m;
expires 2m;
}
location ~ \.m3u8$ {
access_log /var/log/nginx-access-m3u8.log;
error_log /var/log/nginx-error-m3u8.log;
proxy_ignore_headers Cache-Control Expires;
proxy_pass http://[视频源地址]$uri;
proxy_cache m3u8-cache;
proxy_cache_key $host$uri;
proxy_cache_valid 200 304 5s;
expires 5s;
}
location / {
access_log /var/log/nginx-access.log;
error_log /var/log/nginx-error.log;
root /var/www/frontend-src;
}
}
}