windows编译nginx-http-flv-module

windows编译nginx-http-flv-module

1、下载工具包

msys2-x86_64-20190524

ActicePerl-5.24.2.2403-MSWin32-x64-403863.exe

Mercurial-5.1.2-x64

sed-4.2.1-setup

zlib-1.2.8.tar pcre-8.39.tar openssl-1.0.1e.tar

2、下载nginx源码包

运行windows命令行cmd,进入 Mercurial 根目录


hg clone http://hg.nginx.org/nginx

image-20210603134425751

image-20210603134557864

3、下载nginx-http-flv-module源码包

nginx目录建立objs/lib目录,将nginx-http-flv-module-master,openssl-1.1.0d,pcre-8.43,zlib-1.2.11解压进去

image-20210603135007575

4、安装VS2010工具

安装完成将根路径/VC/bin根路径/Common7/IDE加入path环境变量

5、生成Makefile文件

使用MSYS(msys.bat文件)工具定位到nginx根路径,执行以下脚本

auto/configure \
    --with-cc=cl \
    --with-debug \
    --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.39 \
    --with-zlib=objs/lib/zlib-1.2.8 \
    --with-openssl=objs/lib/openssl-1.0.1e \
    --with-openssl-opt=no-asm \
    --with-http_ssl_module \
	--add-module=objs/lib/nginx-http-flv-module-master
image-20210603142232478

当前目录结构

image-20210603162304504

  1. 生成好makefile文件,修改nginx\auto\lib\openssl\makefile.msvc文件:将VC-WIN32改为VC-WIN64A,将ms\do_ms 改为ms\do_win64a
  2. 修改objs\Makefile文件:将“-WX”删除,否则nmake时会报错“nginx error:c2220:警告被视为错误 - 没有生成object文件”

6、编译Nginx源码

以管理员的身份运行安装好的Visual Studio命令提示(2010)工具,切换到nginx根目录 ,执行以下命令

nmake -f objs/Makefile

安装完成

image-20210603163302184

需要注意的问题:

  1. vs2010命令行工具必须以管理员权限运行
  2. lib目录的3个工具包版本一定要兼容,具体的慢慢尝试,否则会出现文件找不到或者其他错误

建议:

不要在windows系统上运行使用nginx-http-flv,nginx目前发现许多问题,nginx官方声明在windows可能造成内存泄漏,目前线上运行1个多月暂时没有发现,目前发现的有nginx会偶尔会出现断连,但是检测不到异常日志信息。有知道的朋友也可以沟通一下

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值