Repository navigation
Expand file tree
/
Copy pathnginx.conf
More file actions
117 lines (102 loc) · 3.32 KB
/
Copy pathnginx.conf
File metadata and controls
117 lines (102 loc) · 3.32 KB
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
109
110
111
112
113
114
115
116
117
server {
listen 80;
server_name localhost;
# --- Performance tuning for video streaming ---
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# Cache file metadata (speeds up HLS/thumbnail access).
open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_min_length 1000;
# Upload limit for the WebUI (resource uploads, banners, avatars).
client_max_body_size 2g;
client_body_buffer_size 128k;
# --- Web UI / API ---
location / {
proxy_pass http://app:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_hide_header Server;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
}
# --- X-Accel-Redirect media offload ---
# WebUI paths are /_protected/<archive>/<filename>; archives live directly
# below VOD_BASE_DIR (/app/data in the container).
location /_protected/ {
internal;
alias /app/data/;
sendfile on;
sendfile_max_chunk 1m;
output_buffers 2 1m;
gzip off;
add_header Accept-Ranges bytes always;
}
# Legacy archives stored below VOD_FILES_DIR (default /app/data/files).
location /_protected_files/ {
internal;
alias /app/data/files/;
sendfile on;
sendfile_max_chunk 1m;
output_buffers 2 1m;
gzip off;
add_header Accept-Ranges bytes always;
}
location /_protected_vodcache/ {
internal;
alias /app/data/.vodcache/;
sendfile on;
sendfile_max_chunk 1m;
output_buffers 2 1m;
gzip off;
add_header Accept-Ranges bytes always;
}
location /_protected_thumbs/ {
internal;
alias /app/data/.thumbs/;
expires 1d;
add_header Cache-Control "public";
}
location /_protected_hls/ {
internal;
alias /app/data/.hls/;
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
video/mp4 m4s mp4;
}
default_type application/octet-stream;
add_header Cache-Control "no-cache";
add_header Accept-Ranges bytes always;
}
location /_protected_hls_live/ {
internal;
alias /app/.hls_live/;
open_file_cache off;
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
video/mp4 m4s mp4;
}
default_type application/octet-stream;
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Accept-Ranges bytes always;
}
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
}