二、nginx-rtmp-module安装
1.1 nginx-rtmp-module介绍
nginx-rtmp-module是nginx下的一个子模块,该模块主要作用是可以搭建一个直播服务器。下面将nginx-rtmp-module简称为NRM。
NRM的出现使得非专业的流媒体开发工程师也可以简单、迅速地搭建流媒体服务器。
NRM的引用特性包含一下集中。
2.1 NRM的搭建
首先,请先参照nginx基础与安装在Linux系统中成功安装nginx。这里所使用的版本为ContOS7 7.8,使用工具为Xshell.
1. 下载NRM
在GitHub中打开nginx-rtmp-module首页,点击"code" "Download.zip"下载压缩包。这里下载的版本为nginx-rtmp-module 1.2.1版本。也可以使用wget命令下载。
nginx-trmp-module的GitHub地址:https://github.com/arut/nginx-rtmp-module/tree/master
2. 创建一个目录
[root@localhost ~]# mkdir /opt/download
3. 上传文件
这里通过xftp工具将下载的nginx-rtmp-module压缩包上传至linux服务器中刚创建的文件夹下。
4. 修改文件名
这里由于nginx-rtsp-module-1.2.1文件名太长我们修改一下文件名称,当然如果对文件名长度无所谓也可以不修改,看个人爱好。
[root@localhost download]# mv nginx-rtmp-module-1.2.1.zip NRM.zip
5. 解压缩文件
[root@localhost download]# unzip NRM.zip
修改文件名,和上一步一样 看个人习惯吧。
[root@localhost download]# mv nginx-rtmp-module-1.2.1 NRM
6. 检查nginx配置
[root@localhost download]# nginx -V
注意V要大写,如下图所示
由于我们在第一张已经配置了nginx的环境变量所以我们这里可以直接使用 nginx 命令,如果你还没有配置nginx的环境变量请看https://blog.csdn.net/Aarstg/article/details/122619555这篇博客。
7. 配置NRM到nginx中
加载NRM库,并输出到指定目录中,最后开启debuglog,如下所示。
首先进入nginx的源目录中(不是安装目录,是tar包解压后的那个nginx目录)。
[root@localhost nginx-1.12.2]# cd /opt/download/nginx-1.12.2/
# 后执行一下命令安装NRM模块到nginx中
[root@localhost nginx-1.12.2]# ./configure --add-module=/opt/download/NRM --prefix=/usr/local/nginx --with-debug
[root@localhost nginx-1.12.2]# make && make install
8. 检查是否安装成功
[root@localhost nginx-1.12.2]# nginx -V
这样就表示安装NRM模块成功了。
9. 启动nginx
[root@localhost nginx-1.12.2]# nginx
# 查看nginx
[root@localhost nginx-1.12.2]# ps -ef|grep nginx
root 64317 1 0 15:21 ? 00:00:00 nginx: master process nginx
nobody 64318 64317 0 15:21 ? 00:00:00 nginx: worker process
root 64329 4166 0 15:21 pts/0 00:00:00 grep --color=auto nginx
启动成功!
到这里我们的nginx-rtmp-module就安装成功了,欲知后续如何请看下章博客。
标签:
相关文章
-
无相关信息