半年前記錄的了, 但是一直忙于工作, 沒有時(shí)間整理...
1.安裝Homebrew(如果還沒安裝的話)
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2.安裝Nginx
brew tap homebrew/nginx
brew install nginx-full --with-rtmp-module
啟動(dòng)nginx
nginx
測試(不出意外的話, 會(huì)看到Welcome to nginx!)
localhost:8080
3.配置RTMP
打開配置文件(mac 10.11 默認(rèn)的地址)
vi /usr/local/etc/nginx/nginx.conf
在配置文件最后面(或者最前面, 不要嵌套在 http{ } 中間)添加RTMP配置.(修改配置后, 重新加載/啟動(dòng)Nginx)
rtmp {
server {
listen 1935;
application rtmplive {
live on;
record off;
}
}
}
關(guān)于RTMP配置信息, 看這里RTMP配置
配置完成之后需要重新啟動(dòng)Nginx服務(wù)器
推流地址: rtmp://192.168.0.101:1935/rtmplive
推流要加上密鑰(房間號(hào)), 完整路徑如:rtmp://192.168.0.101:1935/rtmplive/room
至此完畢!
其他
nginx -s reload //重新加載
nginx -s reopen //重新打開
nginx -s stop //停止
nginx -s quit //退出
//Nginx安裝路徑
/usr/local/Cellar/nginx-full/
//Nginx配置文件路徑
/usr/local/etc/nginx/nginx.conf
//Nginx服務(wù)器根目錄
/usr/local/var/www
//卸載Homebrew(如果需要卸載的話)
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
//Nginx
https://github.com/Homebrew/homebrew-nginx