cd /usr/local/src wget http://nginx.org/download/nginx-1.12.1.tar.gz tar -zxvf nginx-1.12.1.tar.gz mv nginx-1.12.1 nginx cd nginx git clone https://github.com/arut/nginx-rtmp-module.git ./configure --prefix=/usr/local/nginx --add-module=./nginx-rtmp-module --with-http_ssl_module # 编译工程 make && make install
展示
[root@VM-4-3-centos nginx]# cd /usr/local/nginx/ [root@VM-4-3-centos nginx]# ls conf html logs sbin [root@VM-4-3-centos nginx]# cd sbin/ [root@VM-4-3-centos sbin]# ls nginx [root@VM-4-3-centos sbin]# ./nginx -v nginx version: nginx/1.12.1
配置
[root@VM-4-3-centos conf]# cd /usr/local/nginx/conf [root@VM-4-3-centos conf]# vim nginx.conf # 添加如下 rtmp { server { listen 1935 so_keepalive=2s:1:1; #监听的端口 chunk_size 4000; application hls { #rtmp推流请求路径 live on; } } }