标签:show event 分析 nload 服务 docker mod off 1.2
因测试需要配置IPv6环境下的rtmp流媒体服务器,想着直接使用docker镜像,搜索对比后发现这个能满足要求:
https://hub.docker.com/r/tiangolo/nginx-rtmp
但后来确认目标服务器是CentOS 6.5,没办法使用docker,所以就将原作者的dockerfile转换成了shell,方便在没有docker环境的机器上使用。
思路整理:测试环境部署软件的时候可以优先考虑docker方案,就算是自己从无到有部署,dockerfile也会是最好的参考。
整个过程中碰到到以下问题做些说明:
原作者提供nginx配置文件:
1 worker_processes auto; 2 rtmp_auto_push on; 3 events {} 4 rtmp { 5 server { 6 listen 1935; 7 listen [::]:1935 ipv6only=on; 8 application live { 9 live on; 10 record off; 11 } 12 } 13 }
最终安装配置脚本如下:
1 #!/bin/bash 2 # This shell is to install Nginx with nginx-rtmp-module installed and configrued for RTMP Streaming under IPV6 3 4 # Versions of Nginx and nginx-rtmp-module to use 5 NGINX_VERSION=nginx-1.15.0 6 NGINX_RTMP_MODULE_VERSION=1.2.1 7 8 # Download and decompress Nginx 9 mkdir -p /tmp/build/nginx 10 cd /tmp/build/nginx 11 wget --no-check-certificate -O ${NGINX_VERSION}.tar.gz https://nginx.org/download/${NGINX_VERSION}.tar.gz 12 tar -zxf ${NGINX_VERSION}.tar.gz 13 14 # Download and decompress RTMP module 15 mkdir -p /tmp/build/nginx-rtmp-module 16 cd /tmp/build/nginx-rtmp-module 17 wget --no-check-certificate -O nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION}.tar.gz https://github.com/arut/nginx-rtmp-module/archive/v${NGINX_RTMP_MODULE_VERSION}.tar.gz 18 tar -zxf nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION}.tar.gz 19 cd nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION} 20 21 # Install dependencies 22 yum -y install pcre-devel openssl openssl-devel 23 24 # Build and install Nginx 25 # The default puts everything under /usr/local/nginx, so it‘s needed to change 26 # it explicitly. Not just for order but to have it in the PATH 27 cd /tmp/build/nginx/${NGINX_VERSION} 28 ./configure 29 --sbin-path=/usr/local/sbin/nginx 30 --conf-path=/etc/nginx/nginx.conf 31 --error-log-path=/var/log/nginx/error.log 32 --pid-path=/var/run/nginx/nginx.pid 33 --lock-path=/var/lock/nginx/nginx.lock 34 --http-log-path=/var/log/nginx/access.log 35 --http-client-body-temp-path=/tmp/nginx-client-body 36 --with-http_ssl_module 37 --with-threads 38 --with-ipv6 39 --add-module=/tmp/build/nginx-rtmp-module/nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION} 40 make && make install 41 mkdir /var/lock/nginx 42 rm -rf /tmp/build 43 44 # Config RTMP Streaming and IPV6 for Nginx 45 cat >/etc/nginx/nginx.conf <<EOF 46 worker_processes auto; 47 rtmp_auto_push on; 48 events {} 49 rtmp { 50 server { 51 listen 1934; 52 application live4 { 53 live on; 54 record off; 55 } 56 } 57 server { 58 listen [::]:1936 ipv6only=on; 59 application live6 { 60 live on; 61 record off; 62 } 63 } 64 } 65 EOF 66 67 #Show Nginx Version 68 nginx -V
CentOS安装配置nginx-rtmp-module(同时支持IPv4和IPv6)
标签:show event 分析 nload 服务 docker mod off 1.2
原文地址:https://www.cnblogs.com/wp2ypy/p/10300963.html