Ubuntu linux 下搭建 Nginx rtmp 多媒体服务器

  一直是在做海思平台的RTMP推流,之前都是用的别人搭服务器,有时候需要改下配置什么的不是很方便,所以就打算自己建一个测试用。网上搜了下大体是Nginx 或者SRS。

公司用的是SRS  自己就打算试一下Nginx,二话不说 从官网下下来源码包,解压,configure,直接编译,发现要依赖包,网上搜了下 

如下从别人那父之过来的

apt-get install gcc
apt-get install libpcre3 libpcre3-dev
apt-get install zlib1g zlib1g-dev
# Ubuntu14.04的仓库中没有发现openssl-dev,由下面openssl和libssl-dev替代
#apt-get install openssl openssl-dev
sudo apt-get install openssl 
sudo apt-get install libssl-dev

一番操作猛如虎  重新 Configure make  make install 正常 ,没问题 浏览器输入localhost 可以启动,但是咱需要的是rtmp啊 ,改了下 nginx.conf 添加关于rtmp的内容

rtmp{
    server{
        listen 1935;
        application live{
            live on;
            record off;
        }
        application hls{
            live on;
            hls on;
            hls_path nginx-rtmp-modules/hls;
            hls_cleanup off;
        }
    }
}

 

哎 发现报错 不识别rtmp,搜了下原来是 官方的nginx 并不包含rtmp模块,需要单独另外下一个rtmp的module,

官方github地址:https://github.com/arut/nginx-rtmp-module

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

反正我试了好久都没成功,最后直接点击下载 又试了N次 才下下来。

点这里免费下载

看别人的 重新configure 如下

./configure     --add-module=../nginx-rtmp-module-master \
#    --sbin-path=/usr/local/nginx/nginx
#    --conf-path=/usr/local/nginx/nginx.conf
#    --pid-path=/usr/local/nginx/nginx.pid
#    --with-http_ssl_module
#    --with-pcre=../pcre-8.44
#       --with-zlib=../zlib-1.2.11

我习惯把configure的操作 写到一个build.sh脚本里 直接运行这个脚本就可以,这里比较吭,反复修改了好几次才 可以 ,重新make make install之后 ,不能重启nginx服务 nginx.conf里面报错。后来重启了一下机器就好了 , 

试了下推流地址 rtmp://192.168.35.37:1935/live/test

vlc 打开这个地址 就可以 没有问题。。。

Guess you like

Origin blog.csdn.net/baoecit/article/details/120067298