nginx rtmp服务器搭建

安装准备

下载

wget http://nginx.org/download/nginx-1.10.3.tar.gz
wget http://zlib.net/zlib-1.2.11.tar.gz
wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz
wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip

解压

tar -zxvf 文件名
unzip master.zip

nginx编译并添加模块

进入nginx-1.10.3解压目录后执行

./configure --prefix=/usr/local/nginx --with-debug --with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.0.2k --add-module=../nginx-rtmp-module-master

然后编译安装

make
make install

nginx.conf


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        logs/nginx.pid;


events {
    worker_connections  1024;
}

rtmp {
    server {
		listen 1935;
		chunk_size 4096;
		
		application live {
			live on;
		}	
    }
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }
	
		location /stat {    
            rtmp_stat all;
	    	rtmp_stat_stylesheet stat.xsl;
    	}
 
    	location /stat.xsl { 
    		# nginx-rtmp-module解压的目录
            root /*/nginx-rtmp-module-master/;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

验证

[root@host-10-10-9-187 sbin]# ./nginx -Ves of bean [name : org.apache.dub
nginx version: nginx/1.10.3
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) es of bean [name : org.apache.dub
built with OpenSSL 1.0.2k  26 Jan 2017
TLS SNI support enabledn[type:ReferenceBean] has been bu
configure arguments: --prefix=/usr/local/nginx --with-debug --with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.11 --with
-openssl=../openssl-1.0.2k --add-module=../nginx-rtmp-module-master

打开浏览器输入:http://ip:1935/stat,
在这里插入图片描述
使用VLC media player测试rtmp地址播放
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值