您当前的位置: 首页 >  服务器

令狐掌门

暂无认证

  • 3浏览

    0关注

    513博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

ubuntu搭建nginx-rtmp服务器

令狐掌门 发布时间:2020-01-05 21:25:33 ,浏览量:3

       rtmp的服务器有很多,本篇博客介绍如何安装配置nginx-rtmp服务器。

       系统ubuntu, deepin或者其它linux版本。

先安装以下依赖
sudo apt-get install libssl-dev

sudo apt-get install libpcre3 libpcre3-dev

sudo apt-get install openssl libssl-dev 
 
sudo apt-get install zlib1g-dev  

sudo apt-get install git

sudo apt-get install wget

nginx官网 http://nginx.org

创建文件夹存放nginx

mkdir rtmp

cd rtmp

wget http://nginx.org/download/nginx-1.13.3.tar.gz

去github下载nginx-rtmp模块

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

tar -zxvf nginx-1.13.3.tar.gz

cd nginx-1.13.3

./configure --add-module=../nginx-rtmp-module

make

make install

由于版本nginx版本不同,这里不一定能编译通过。

没报错的话,会有如下目录

cd /usr/local/nginx

cd sbin

启动nginx ./nginx

启动niginx时也可能出现错误,如下:

asdf@ubuntu:/usr/local/nginx/sbin$ ./nginx nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied) 2021/07/07 07:39:22 [emerg] 23751#0: mkdir() "/usr/local/nginx/client_body_temp" failed (13: Permission denied)

此时需要修改权限

sudo chown root nginx sudo chmod u+s nginx

查看进程

ps -ef|grep nginx

ifconfig 查看ip,浏览器访问ip,看到下图, 说明nginx安装ok.

注意:这是动态ip, 每次开机启动都不同,如果推流失败可能是ip变动了。

配置rtmp服务

配置文件修改, cd到nginx的conf目录  vim nginx.conf 添加如下内容

重启nginx

pkill nginx

重启./nginx

推本地流测试

ffmpeg -re -i 1.mp4 -f flv rtmp://192.168.126.132/live

VLC播放测试

关注
打赏
1652240117
查看更多评论
立即登录/注册

微信扫码登录

0.0729s