下载并解压模块:
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip unzip master.zip
停止运行的Nginx服务:
nginx -s stop
配置并编辑:
./configure --add-module=/home/nginx-rtmp-module-master make
make install
复制Nginx:
## 路径根据自己软件路径自行配置 cp /home/build/nginx-1.11.2/objs/nginx /usr/local/nginx/sbin
配置rtmp服务:
rtmp { #RTMP服务 server { listen 1935; #//服务端口 chunk_size 4096; #//数据传输块的大小 application vod { play /opt/video; #//视频文件存放位置。 } application live{ #直播开启 live on; } } }
检查并启动服务:
nginx -t nginx
另附我自己用来测试的配置文件,5个输出
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
|
worker_processes 1; error_log logs/error.log debug; events { worker_connections 1024; } rtmp { server { listen 1935; application live1 { live on ; } application live2 { live on ; } application live3 { live on ; } application live4 { live on ; } application live5 { live on ; } application hls { live on ; hls on ; hls_path temp/hls; hls_fragment 8s; } } } http { server { listen 80; location / { root html; } location /stat { rtmp_stat all; rtmp_stat_stylesheet stat.xsl; } location /stat.xsl { root html; } location /hls { #server hls fragments types{ application/vnd.apple.mpegurl m3u8; video/mp2t ts; } alias temp/hls; expires -1; } } } |