编译windows版nginx-rtmp-module

准备工作

要在 Microsoft Win32® 平台上编译Nginx你需要:

  • Microsoft Visual C compiler. Microsoft Visual Studio® 8 and 10 are known to work.(用来编译)
  • MSYS.(执行配置脚本)
  • Perl, if you want to build OpenSSL® and nginx with SSL support. For example ActivePerl or Strawberry Perl.(注意这里不能使用MSYS的perl)
  • Mercurial client.(通过HG下载最新源码)
  • PCREzlib and OpenSSL libraries sources.(PCRE用来重写url,zlib支持页面压缩,这里编译rtmp模块,必须编译出openssl)
  • win32版nginx-rtmp-module模块源代码

编译步骤

在开始之前,你需要将Perl,Mercurial,MSYS bin目录加入PATH环境变量,也就是打开cmd,输入perl,hg,bash不会提示找不到命令.运行vcvarsall.bat或者叫Visual Studio命令提示(2010).

  • 敲入bash,进入msys的环境
  • 从hg.nginx.org检出最新的Nginx源代码
    hg clone http://hg.nginx.org/nginx
  • Create a build and lib directories, and unpack zlib, PCRE and OpenSSL libraries sources into lib directory: 创建一个编译和库目录,并且解压zlib,PCRE,OpenSSL,git回win32分支的nginx-rtmp-module模块
    mkdir objs/lib -p
    cd objs/lib
    tar -xzf pcre-8.32.tar.gz
    tar -xzf zlib-1.2.8.tar.gz
    tar -xzf openssl-1.0.1e.tar.gz
    unzip nginx-rtmp-module-win32.zip (也可使用git)
  • 回到nginx主目录,运行配置脚本
    auto/configure --with-cc=cl --builddir=objs --prefix= \
    --conf-path=conf/nginx.conf --pid-path=logs/nginx.pid \
    --http-log-path=logs/access.log --error-log-path=logs/error.log \
    --sbin-path=nginx.exe --http-client-body-temp-path=temp/client_body_temp \
    --http-proxy-temp-path=temp/proxy_temp \
    --http-fastcgi-temp-path=temp/fastcgi_temp \
    --http-scgi-temp-path=temp/scgi_temp \
    --http-uwsgi-temp-path=temp/uwsgi_temp \
    --with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs/lib/pcre-8.32 \
    --with-zlib=objs/lib/zlib-1.2.8 --with-openssl=objs/lib/openssl-1.0.1e \
    --with-select_module --with-http_ssl_module --add-module=objs/lib/nginx-rtmp-module-win32
  • 编译
    nmake -f objs/Makefile

成功后会在objs目录内生成nginx.exe文件,创建conf,logs,temp,tmp目录,将nginx-rtmp-module-win32/test/nginx.conf拷贝到conf目录,运行nginx.exe

使用任意rtmp客户端测试,默认app为myapp的直播应用,请参考官方配置开启record,vod等功能.

注意事项:
由于原作者是在*UNIX环境开发,使用了部分UNIX系统调用,部分功能在windows上暂时无法实现,比如vod 为mp4文件,exec ffmpeg来切片.但作为直播流,点播flv文件,在线录制是没有问题的.

下载撸主的编译版本:https://github.com/illuspas/nginx-rtmp-win32

原创文章,转载请注明: 转载自贝壳博客

本文链接地址: 编译windows版nginx-rtmp-module

此条目由  阿亮 发表在  RTMP服务端流媒体 分类目录,并贴了  rtmp 标签。将 固定链接加入收藏夹。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值