CentOS8.0搭建nginx与nginx-rtmp-module搭建流媒体服务器
文章原地址:http://blog.csdn.net/zph1234/article/details/52846223
本次搭建流媒体使用的环境是centos 8.0+nginx;让我们一起开始奇妙的流媒体之旅吧!
下载git
Yum install git
下载nginx-rtmp-module
nginx-rtmp-module的官方github地址:https://github.com/arut/nginx-rtmp-module
使用命令:
git clone https://github.com/arut/nginx-rtmp-module.git
将nginx-rtmp-module下载到linux中。
下载nginx
nginx的官方网站为:http://nginx.org/en/download.html,到这个网站下找到最新版本,替换版本号。
wget http://nginx.org/download/nginx-1.19.0.tar.gz
tar -zxvf nginx-1.19.0.tar.gz
安装Nginx
cd nginx-1.19.0
./configure --prefix=/usr/local/nginx --add-module=…/nginx-rtmp-module --with-http_ssl_module
此时出现的问题1:pcre
此处出现这个问题:没有出现的话,忽略
./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=
需要安装PCRE,使用下面的命令
yum install pcre-devel
此时出现的问题2:openssl
再出现这个问题,没有出现的话,忽略
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=
需要安装openssl
执行这个命令:
Yum install openssl-devel
编译
现在没有问题了,可以执行下面的命令了:
make && make install
编译出现的问题
结果出现这个提示:
…/nginx-rtmp-module/ngx_rtmp_eval.c: In function ‘ngx_rtmp_eval’:
…/nginx-rtmp-module/ngx_rtmp_eval.c:160:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
switch © {
^~~~~~
…/nginx-rtmp-module/ngx_rtmp_eval.c:170:13: note: here
case ESCAPE:
^~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1349: objs/addon/nginx-rtmp-module/ngx_rtmp_eval.o] Error 1
make[1]: Leaving directory ‘/home/lsl/rtmp-install/nginx-1.19.0’
make: *** [Makefile:8: build] Error 2
这个时候参考:https://blog.csdn.net/jaybill/article/details/80164370
Cd objs
Vi Makefile
在后面增加-Wno-implicit-fallthrough 选项。
回到上级目录,再次执行
Cd…
make && make install
本文详细介绍了在CentOS8.0环境下,如何使用Nginx和nginx-rtmp-module搭建流媒体服务器的过程,包括下载git、nginx及nginx-rtmp-module,解决编译过程中遇到的pcre和openssl问题,以及如何处理编译错误。

2520

被折叠的 条评论
为什么被折叠?



