在centos7中的nginx上安装扩展nginx-rtmp-module模块(直播用)

到nginx官网下载nginx 官网下载页面http://nginx.org/en/download.html

nginx下载.png

将nginx包上传到centos服务器, 解压到/usr/local/src/nginx-1.15.1目录中

进入/usr/local/src/目录中,创建rtmq目录并进入目录中,从github上把模块拉下来

mk rtmq
cd rtmq
git clone https://github.com/arut/nginx-rtmp-module.git 

进入nginx目录中(nginx-1.15.1),执行以下命令

[root@common-server nginx-1.15.1]# ./configure --prefix=/usr/local/src/nginx-1.15.1/ --add-module=../rtmp/n ginx-rtmp-module --with-http_ssl_module
checking for OS
 + Linux 3.10.0-693.21.1.el7.x86_64 x86_64
checking for C compiler ... not found

./configure: error: C compiler cc is not found

提示没有安装gcc, 执行以下命令安装

[root@common-server nginx-1.15.1]# yum install gcc gcc-c++

安装完gcc后在执行

[root@common-server nginx-1.15.1]# ./configure --prefix=/usr/local/src/nginx-1.15.1/ --add-module=../rtmp/n ginx-rtmp-module --with-http_ssl_module

发生错误 ,提示使用--without-http_rewrite_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.

加上参数--without-http_rewrite_module后在执行

[root@common-server nginx-1.15.1]# ./configure --prefix=/usr/local/src/nginx-1.15.1/ --add-module=../rtmp/n ginx-rtmp-module --with-http_ssl_module --without-http_rewrite_module

发生错误 ,提示没有安装SSL

./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= option.

安装SSL

yum -y install openssl openssl-devel  

安装完成后在执行

[root@common-server nginx-1.15.1]# ./configure --prefix=/usr/local/src/nginx-1.15.1/ --add-module=../rtmp/n ginx-rtmp-module --with-http_ssl_module --without-http_rewrite_module

返回信息(末尾部分):

configuring additional modules
adding module in ../rtmp/nginx-rtmp-module
 + ngx_rtmp_module was configured
checking for OpenSSL library ... found
checking for zlib library ... found
creating objs/Makefile

Configuration summary
  + PCRE library is not used
  + using system OpenSSL library
  + using system zlib library

  nginx path prefix: "/usr/local/src/nginx-1.15.1/"
  nginx binary file: "/usr/local/src/nginx-1.15.1//sbin/nginx"
  nginx modules path: "/usr/local/src/nginx-1.15.1//modules"
  nginx configuration prefix: "/usr/local/src/nginx-1.15.1//conf"
  nginx configuration file: "/usr/local/src/nginx-1.15.1//conf/nginx.conf"
  nginx pid file: "/usr/local/src/nginx-1.15.1//logs/nginx.pid"
  nginx error log file: "/usr/local/src/nginx-1.15.1//logs/error.log"
  nginx http access log file: "/usr/local/src/nginx-1.15.1//logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

你可能感兴趣的:(在centos7中的nginx上安装扩展nginx-rtmp-module模块(直播用))