美文网首页
Mac下搭建RTMP流媒体(直播)服务器

Mac下搭建RTMP流媒体(直播)服务器

作者: 孟圆的笔记 | 来源:发表于2018-10-30 15:11 被阅读0次
  1. 打开VPN。

  2. 安装homebrew包管理软件:

安装命令
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

移除命令
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

 

  1. 从github下载home-brew对nginx的扩展:
brew tap denji/nginx

安装 Nginx服务器 和 RTMP模块:

brew install nginx-full --with-rtmp-module

 

#brew 卸载软件
brew uninstall nginx

#查看安装信息(经常用到, 比如查看安装目录等):
brew info nginx

#查看已经安装的软件:
brew list

 

4.安装信息,附带启动信息:

==> nginx-full
Docroot is: /usr/local/var/www
The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /usr/local/etc/nginx/servers/.

- Tips -
Run port 80:
 $ sudo chown root:wheel /usr/local/opt/nginx-full/bin/nginx
 $ sudo chmod u+s /usr/local/opt/nginx-full/bin/nginx

Reload config:
 $ nginx -s reload
Reopen Logfile:
 $ nginx -s reopen
Stop process:
 $ nginx -s stop
Waiting on exit process
 $ nginx -s quit

To have launchd start denji/nginx/nginx-full now and restart at login:
  brew services start denji/nginx/nginx-full
Or, if you don't want/need a background service you can just run:
  nginx

 

  1. 配置RTMP服务:
#配置rtmp server
rtmp {
        server {
                listen        1935;
                chunk_size    4000;

                #配置了一个叫live的应用
                application live {
                        live       on;       #保持开启
                        record     off;      #停止录制
                        allow play all;      #允许所有请求
                }
        }
}

 

检测rtmp服务有没有启动:

netstat -an |grep 1935

tcp4       0      0  *.1935                 *.*                    LISTEN 

相关文章

网友评论

      本文标题:Mac下搭建RTMP流媒体(直播)服务器

      本文链接:https://www.haomeiwen.com/subject/uvygtqtx.html