Redhat7 通过Nginx 扩展Nginx-rtmp-module
一、 下载Nginx、Nginx-rtmp-module
[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# ll
总用量 0
[root@localhost src]# wget http://nginx.org/download/nginx-1.15.3.tar.gz
–2018-09-02 21:37:27– http://nginx.org/download/nginx-1.15.3.tar.gz
正在解析主机 nginx.org (nginx.org)… 95.211.80.227, 206.251.255.63, 2001:1af8:4060:a004:21::e3, …
正在连接 nginx.org (nginx.org)|95.211.80.227|:80… 已连接。
已发出 HTTP 请求,正在等待回应… 200 OK
长度:1022881 (999K) [application/octet-stream]
正在保存至: “nginx-1.15.3.tar.gz”
100%[=====================================================================================================================================================>] 1,022,881 162KB/s 用时 43s
2018-09-02 21:38:16 (23.3 KB/s) - 已保存 “nginx-1.15.3.tar.gz” [1022881/1022881])
tar -zxvf nginx-1.15.3.tar.gz
git clone https://github.com/arut/nginx-rtmp-module.git
见附件
Unzip nginx-rtmp-module.zip
./configure –prefix=/usr/local/nginx –add-module=../nginx-rtmp-module-master –with-http_ssl_module
checking for OS
+ Linux 3.10.0-123.el7.x86_64 x86_64
checking for C compiler … not found
./configure: error: C compiler cc is not found
gcc_rpm.tar.gz
sh install.sh
./configure –prefix=/usr/local/nginx –add-module=../nginx-rtmp-module-master –with-http_ssl_module
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using –without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using –with-pcre= option.
Lib.zip
Make & make install
修改nginx配置文件
vi /usr/local/nginx/conf/nginx.conf
rtmp {
server {
listen 1935;
application live {
live on;
}
application hls {
live on;
hls on;
hls_path temp/hls;
hls_fragment 8s;
}
}
}
./sbin/nginx
nginx: [alert] could not open error log file: open() “/usr/local/nginx/logs/error.log” failed (2: No such file or directory)
2018/09/02 23:45:40 [emerg] 71655#0: mkdir() “temp/hls” failed (2: No such file or directory)
mkdir -p temp/hls
mkdir logs