-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
176 lines (150 loc) · 4.67 KB
/
nginx.conf
File metadata and controls
176 lines (150 loc) · 4.67 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
user nginx;
worker_processes auto;
worker_rlimit_nofile 65535;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 4096;
use epoll;
multi_accept on;
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
# HLS
hls on;
hls_path /tmp/hls;
hls_fragment 3;
hls_playlist_length 60;
# DASH
dash on;
dash_path /tmp/dash;
dash_fragment 3;
dash_playlist_length 60;
}
application vod {
play /var/media;
}
}
}
http {
include mime.types;
default_type application/octet-stream;
# Logging
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
# Basic Settings
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
# Buffers
client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 2 1k;
# Timeouts
client_body_timeout 12;
client_header_timeout 12;
send_timeout 10;
# Gzip Settings
gzip on;
gzip_vary on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_disable "MSIE [1-6]\.";
# VOD Settings
vod_mode local;
vod_metadata_cache metadata_cache 512m;
vod_response_cache response_cache 128m;
vod_last_modified_types *;
vod_segment_duration 10000;
vod_align_segments_to_key_frames on;
# Removed problematic directives:
# vod_dash_fragment_file_name_prefix "segment";
# vod_hls_fragment_file_name_prefix "segment";
# Lua Settings
lua_package_path '/usr/local/nginx/conf/lua/?.lua;;';
lua_shared_dict video_thumbs 10m;
server {
listen 80;
listen [::]:80;
server_name localhost;
# SSL configuration
#listen 443 ssl http2;
#ssl_certificate /etc/nginx/ssl/server.crt;
#ssl_certificate_key /etc/nginx/ssl/server.key;
#ssl_protocols TLSv1.2 TLSv1.3;
#ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
#ssl_prefer_server_ciphers off;
#ssl_session_timeout 1d;
#ssl_session_cache shared:SSL:50m;
#ssl_session_tickets off;
#ssl_stapling on;
#ssl_stapling_verify on;
# HLS Streaming
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
}
# DASH Streaming
location /dash {
types {
application/dash+xml mpd;
video/mp4 mp4;
}
root /tmp;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
}
# VOD Streaming
location /vod {
vod hls;
alias /var/media;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}
# Thumbnail Generation
location /thumb {
video_thumbextractor;
video_thumbextractor_video_filename $arg_video;
video_thumbextractor_video_second $arg_second;
video_thumbextractor_image_width $arg_width;
video_thumbextractor_image_height $arg_height;
video_thumbextractor_only_keyframe on;
video_thumbextractor_next_time on;
alias /var/media;
}
# RTMP Statistics
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root /usr/local/nginx/conf;
}
# RTMP Control
location /control {
rtmp_control all;
}
# Health Check
location /health {
access_log off;
return 200 "healthy\n";
}
}
}