下载 nginx
git clone https://github.com/nginx/nginx.git
下载 nginx-rtmp-module
git clone https://github.com/arut/nginx-rtmp-module.git
安装依赖库
sudo apt install libssl-dev
编译
./auto/configure --add-module=/home/forrest/Code/nginx-rtmp-module
make -j8
sudo make install
配置nginx, 修改 /usr/local/nginx/conf
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
}
}
}
运行 nginx
cd /usr/local/nginx/sbin
sudo ./nginx
查看 nginx 是否启动成功
配置网页查看推流的状态
server {
listen 8080;
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root /home/forrest/Code/nginx-rtmp-module;
}
}
重新运行 nginx
sudo pkill nginx
sudo ./nginx