-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathvod.nginx.conf
120 lines (100 loc) · 3.55 KB
/
vod.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
worker_processes auto;
events {
use epoll;
}
http {
log_format main '$remote_addr $remote_user [$time_local] "$request" '
'$status "$http_referer" "$http_user_agent"';
access_log /dev/stdout main;
error_log stderr debug;
default_type application/octet-stream;
include /usr/local/nginx/conf/mime.types;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
#reset_timedout_connection on;
# File handle caching and aio.
aio on;
open_file_cache max=1000 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
# VOD settings.
vod_mode mapped;
vod_upstream_location /vod-meta-internal;
vod_remote_upstream_location /vod;
vod_last_modified_types *;
vod_max_mapping_response_size 64m;
#vod_align_segments_to_key_frames on;
#vod_output_buffer_pool 64k 32;
# VOD caches.
#vod_metadata_cache metadata_cache 128m 1m;
#vod_live_response_cache response_cach 64m 10s;
#vod_live_mapping_cache mapping_cach 8 1ms;
# gZIP manifests.
gzip on;
gzip_types application/vnd.apple.mpegurl
application/dash+xml
text/xml
video/f4m;
server {
listen 80 default_server;
server_name localhost;
root /var/www;
location ^~ /vod-status/ {
vod_status;
}
location ^~ /vod-meta/ {
rewrite ^/vod-meta/(.*) /$1 break;
proxy_pass http://127.0.0.1:8080$uri$is_args$args;
#client_max_body_size 10M;
}
location ^~ /vod-meta-internal/ {
internal;
proxy_pass http://127.0.0.1:8080$request_uri;
}
location ^~ /vod/ {
# The second location is required, because `vod_remote_upstream_location`
# is working only with `proxy_pass`, and serving static directly won't
# work. See for details:
# https://github.com/kaltura/nginx-vod-module/issues/261#issuecomment-202430721
location ^~ /vod/cached/ {
rewrite ^/vod/cached/(.*) /$1 break;
root /var/www/video/;
}
location ^~ /vod/local/ {
rewrite ^/vod/local/(.*) /$1 break;
proxy_pass http://127.0.0.1/vod/cached$uri;
}
location ^~ /vod/api.allatra.video/ {
rewrite ^/vod/api.allatra.video/(.*) /$1 break;
proxy_pass https://api.allatra.video/storage/videos$uri;
proxy_ssl_server_name on;
resolver 1.1.1.1 8.8.8.8 8.8.4.4 valid=30s;
}
}
location /hls/ {
vod hls;
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
add_header Access-Control-Allow-Origin '*';
}
location /dash/ {
vod dash;
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
add_header Access-Control-Allow-Origin '*';
}
# Disable unnecessary access logs.
location = /favicon.ico {
access_log off;
error_log off;
}
location = /robots.txt {
access_log off;
error_log off;
}
}
}