入门客AI创业平台(我带你入门,你带我飞行)
博文笔记

编译windows版nginx-rtmp-module

创建时间:2016-03-24 投稿人: 浏览次数:2946

http://bashell.nodemedia.cn/archives/build-nginx-rtmp-module-on-windows.html

>>>>>整合版,一键运行,点我<<<<<

准备工作

要在 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下载最新源码)
  • PCRE,?zlib?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源代码
    1 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模块
    1 2 3 4 5 6 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主目录,运行配置脚本
    1 2 3 4 5 6 7 8 9 10 11 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
  • 编译
    1 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文件,在线录制是没有问题的.

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

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

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


声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。