利用NGINX搭建部署直播流媒体服务器

3bd04a1649beb8a682a89f6de3c3f82a.png

直播如今是一个老生常谈的问题,怎么用于直播,大多数人只晓得,大佬某平台直播软件,点击开始即可直播。那么如何来搭建一个简易的直播平台呢?仅仅是有直播功能,没有涉及转码以及播放软件。

安装nginx以及rtmp模块


root@cby:~# apt install nginx
root@cby:~# apt install libnginx-mod-rtmp


修改配置以支持rtmp
root@cby:~# vim /etc/nginx/nginx.conf
rtmp {
    server {
        listen 1935;
        chunk_size 4096;
        application live {
            live on;
        }
    }
}


检查是否有报错
root@cby:~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root@cby:~# 


重启nginx
root@cby:~# systemctl restart nginx

使用obs直播工具进行推流操作

rtmp://<你的域名或者IP>:1935/live

4aed6953d94d42cd13dd1a30aa60ef9a.png

使用vlc拉流播放

69e76a6a2a5909c41c7ff77091fc80b6.png

查看效果

182bf0612a0ab023ae5f41c949f4e0bf.png

c8bfde0c38008cc2c988448f248c143d.png

https://www.oiox.cn/

https://www.chenby.cn/

https://cby-chen.github.io/

https://weibo.com/u/5982474121

https://blog.csdn.net/qq_33921750

https://my.oschina.net/u/3981543

https://www.zhihu.com/people/chen-bu-yun-2

https://segmentfault.com/u/hppyvyv6/articles

https://juejin.cn/user/3315782802482007

https://space.bilibili.com/352476552/article

https://cloud.tencent.com/developer/column/93230

https://www.jianshu.com/u/0f894314ae2c

https://www.toutiao.com/c/user/token/MS4wLjABAAAAeqOrhjsoRZSj7iBJbjLJyMwYT5D0mLOgCoo4pEmpr4A/

CSDN、GitHub、知乎、开源中国、思否、掘金、简书、腾讯云、哔哩哔哩、今日头条、新浪微博、个人博客、全网可搜《小陈运维》

posted @ 2022-03-23 17:40  小陈运维  阅读(40)  评论(0编辑  收藏  举报  来源