1. 安装相关依赖

    yum install -y perl-ExtUtils-Embed \
    readline-devel zlib-devel pam-devel \
    libxml2-devel libxslt-devel openldap-devel \
    python-devel openssl-devel cmakepcre-develnanowget  \
    gcc gcc-c++ ncurses-devel perl git
    

    `

  2. 编译命令:

    mkdir ~/nginx_sources ~/nginx
    cd ~/nginx_sources
    git clone https://github.com/winshining/nginx-http-flv-module.git
    curl -O -L http://hg.nginx.org/nginx/archive/stable-1.22.tar.gz     # 其他版本 http://hg.nginx.org/nginx/archive/release-1.23.1.zip
    tar xzvf stable-1.22.tar.gz
    cd nginx-stable-1.22
    ./auto/configure --prefix="$HOME/nginx" --sbin-path="$HOME/nginx" \
    --with-select_module \
    --with-poll_module \
    --with-file-aio \
    --with-http_ssl_module \
    --with-http_realip_module \
    --with-http_sub_module \
    --with-http_flv_module \
    --add-module="../nginx-http-flv-module" \
    --with-http_mp4_module \
    --with-http_gzip_static_module \
    --with-http_secure_link_module \
    --with-http_stub_status_module \
    --with-http_perl_module \
    --with-ld-opt="-Wl,-E"
    make
    make install
    
  3. 注意事项:

    在目录: /usr/local/lib64/perl5 文件夹下也有需要的动态库和文件( nginx.so 文件和 nginx.pm 文件)

  4. 移植后运行,如果出现如下错误提示,说明缺少依赖的动态库 nginx.songinx.pm 文件:

    Can't load './nginx' for module nginx: ./nginx: cannot dynamically load executable at /usr/lib64/perl5/DynaLoader.pm line 190.
    at -e line 0.
    Compilation failed in require.
    BEGIN failed--compilation aborted.
    nginx: [alert] perl_parse() failed: 255
    

    `

参考:

  1. 【入门】ffmpeg、nginx、nginx-http-flv-module转发rtsp流、VLC查看
  2. Building nginx from Sources