ubuntu nginx rtmp服务器配置

下载

wget http://nginx.org/download/nginx-1.10.3.tar.gz
wget http://zlib.net/zlib-1.2.11.tar.gz
wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz
wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip

编译

./configure --prefix=/usr/local/nginx --with-debug --with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.11 \
--with-openssl=../openssl-1.0.2k --add-module=../nginx-rtmp-module-master
make
sudo make install

启动
/usr/local/nginx/sbin/nginx

测试

zxc@ubuntu:/usr/local/nginx/sbin$ curl 127.0.0.1 -I
HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Thu, 01 Apr 2021 09:23:30 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Thu, 01 Apr 2021 09:01:24 GMT
Connection: keep-alive
ETag: "60658be4-264"
Accept-Ranges: bytes

配置rtmp

rtmp {   
    server {   
        listen 1935;  

        application live {   
            live on;  
        }   

        application hls {   
            live on;  
            hls on;  
            hls_path /tmp/hls;  
        }   

        application vod {
            play /tmp/video;
        }   

    }   
}

重启后即可推流

zxc@ubuntu:/usr/local/nginx/sbin$ sudo netstat -ntlp      
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:3389            0.0.0.0:*               LISTEN      1551/xrdp       
tcp        0      0 0.0.0.0:1935            0.0.0.0:*               LISTEN      27511/nginx     
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      27511/nginx     
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      15903/apache2   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      4422/sshd       
tcp        0      0 127.0.0.1:3350          0.0.0.0:*               LISTEN      1560/xrdp-sesman
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      13079/cupsd     
tcp6       0      0 :::3306                 :::*                    LISTEN      10687/mysqld    
posted @ 2021-04-01 18:12  thomas_blog  阅读(300)  评论(0编辑  收藏  举报