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
3、下载nginx-http-flv-module源码包
nginx目录建立objs/lib目录,将nginx-http-flv-module-master,openssl-1.1.0d,pcre-8.43,zlib-1.2.11解压进去
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
当前目录结构
- 生成好makefile文件,修改nginx\auto\lib\openssl\makefile.msvc文件:将VC-WIN32改为VC-WIN64A,将ms\do_ms 改为ms\do_win64a
- 修改objs\Makefile文件:将“-WX”删除,否则nmake时会报错“nginx error:c2220:警告被视为错误 - 没有生成object文件”
6、编译Nginx源码
以管理员的身份运行安装好的Visual Studio命令提示(2010)工具,切换到nginx根目录 ,执行以下命令
nmake -f objs/Makefile
安装完成
需要注意的问题:
- vs2010命令行工具必须以管理员权限运行
- lib目录的3个工具包版本一定要兼容,具体的慢慢尝试,否则会出现文件找不到或者其他错误
建议:
不要在windows系统上运行使用nginx-http-flv,nginx目前发现许多问题,nginx官方声明在windows可能造成内存泄漏,目前线上运行1个多月暂时没有发现,目前发现的有nginx会偶尔会出现断连,但是检测不到异常日志信息。有知道的朋友也可以沟通一下