1.下载nginx
wget http://nginx.org/download/nginx-1.15.1.tar.gz
2.下载nginx-rtmp-module
wget https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/archive/dev.zip
3.解压
tar -zxvf nginx-1.15.1.tar.gz unzip dev.zip
4.进入nginx-1.15目录,进行编译
./configure --prefix=/usr/local/nginx --add-module=../nginx-rtmp-module-dev --with-http_ssl_module --with-http_stub_status_module make
5.如果已经安装了nginx,则不用make install,否则会覆盖,在编译完nginx-1.15目录下有个objs目录,cp ./nginx /usr/local/nginx/sbin/
把原有的nginx覆盖就好了。
6.在nginx.conf文件最后添加
rtmp { server { listen 1935; #监听的端口 chunk_size 4000; application hls { #rtmp推流请求路径 live on; hls on; hls_path /home/hls; hls_fragment 5s; } } }