• 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    
    
  • 相关阅读:
    MyISAM 和 InnoDB 索引的区别
    iOS crash日志
    。。。
    redis的缓存测试
    job测试
    笔记
    Android获取启动页面Activity方法
    UI自动化框架-一个小demo
    mitmproxy-java 的尝试
    monkey
  • 原文地址:https://www.cnblogs.com/zhangxuechao/p/14607561.html
Copyright © 2020-2023  润新知