1.下载nginx源码
http://nginx.org/en/download.html
2.下载nginx-rtmp-module
https://github.com/arut/nginx-rtmp-module
3.下载openssl
https://github.com/openssl/openssl.git
4.配置nginx make文件
./configure --prefix=/usr/local/nginx --add-module=path/to/nginx-rtmp-module --with-openssl=path/to/openssl
5.编译nginx
make -j 4
6.安装nginx
make install
7.修改nginx配置文件(/usr/local/nginx/conf/nginx.conf),在http服务同级别位置添加如下代码
#rtmp 服务
rtmp {
server {
#指定端口号
listen 1935;
chunk_size 4000;
#指定流应用
application myapp {
live on;
allow play all;
}
}
}
- 推拉流地址:rtmp://localhost:1935/myapp/xxx,(xxx)自定义
8.启动nginx服务器
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf