Windows编译Nginx及nginx-rtmp-module

参考文章:

https://blog.csdn.net/longji/article/details/52369618

最近因处理漏洞问题重新编译了Windows的Nginx,有一些坑记录下来,以便以后回查。

大部分流程参考上面的这个文章。

源码下载最好是http://hg.nginx.org/nginx/在这里下载。用hg也可以,只是个人觉得不方便。

所用OpenSSL为1.1.0h,zlib为1.2.11,pcre为8.39

Nginx为1.17.6

进入C盘msys目录,双击msys.bat打开mingw32的窗口

cd到nginx的目录

编译配置命令

auto/configure --with-cc=cl --builddir=build --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=build/lib/pcre-8.39 \
--with-zlib=build/lib/zlib-1.2.11 --with-openssl=build/lib/openssl-1.1.0h \
--with-select_module --with-http_ssl_module \
--with-http_sub_module \
--add-module=build/lib/nginx-rtmp-module-1.2.1

提示 auto/cc/msvc: line 117: [: : integer expression expected

则修改文件nginx源码目录\auto\cc\msvc 即可,在 echo " + cl version: $NGX_MSVC_VER" 的前面加入一行 NGX_MSVC_VER=15.00

开始编译:

另开一个cmd窗口

我使用的是VS2017,执行如下命令初始化环境。

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"

#然后

nmake -f build/Makefile

#开始编译

 

其他参考:

https://blog.csdn.net/silent_missile/article/details/99317811

https://blog.csdn.net/u010505059/article/details/92661913

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值