-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathnginx.conf
121 lines (101 loc) · 3.4 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
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
daemon off;
user www-data;
error_log /dev/stdout info;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
chunk_size 4000;
application live {
live on;
on_publish http://localhost/on_publish.php;
on_record_done http://localhost/on_record_done.php;
exec ffmpeg -i rtmp://localhost:1935/live/$name
-c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 2500k -f flv -g 30 -r 30 -s 1280x720 -preset superfast -profile:v baseline rtmp://localhost:1935/adaptive/$name_hi
-c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 750k -f flv -g 30 -r 30 -s 640x360 -preset superfast -profile:v baseline rtmp://localhost:1935/adaptive/$name_mid
-c:a libfdk_aac -b:a 64k -c:v libx264 -b:v 200k -f flv -g 15 -r 15 -s 426x240 -preset superfast -profile:v baseline rtmp://localhost:1935/adaptive/$name_low;
recorder video{
record all;
record_path /data/recorders;
record_notify on;
record_max_size 4096M;
record_suffix -%d-%b-%y-%T.flv;
}
}
application adaptive {
live on;
hls on;
hls_path /data/hls;
hls_nested on;
hls_fragment 5s;
hls_playlist_length 60s;
allow play all;
allow publish 127.0.0.1;
deny publish all;
hls_variant _hi BANDWIDTH=2628000,RESOLUTION=1280x720;
hls_variant _mid BANDWIDTH=878000,RESOLUTION=640x360;
hls_variant _low BANDWIDTH=264000,RESOLUTION=426x240;
}
}
}
http {
access_log /dev/stdout combined;
server {
listen 80;
listen 443 ssl;
ssl_certificate /opt/certs/example.com.crt;
ssl_certificate_key /opt/certs/example.com.key;
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /data;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
}
location /live {
alias /data/hls;
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
}
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet static/stat.xsl;
}
location /control {
rtmp_control all;
}
location /static {
alias /static;
}
location = /crossdomain.xml {
root /opt/static;
default_type text/xml;
expires 24h;
}
location /stat.xsl {
root /opt/static;
}
location / {
root /opt/static;
index index.html index.htm;
}
location ~ \.php$ {
root /opt/static;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include /config/fastcgi.conf;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
}