Windows compiles Nginx and nginx-rtmp-module

Reference article:

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

Recently, Nginx for Windows was recompiled due to handling the vulnerability, and some pits have been recorded for future review.

Most of the process refers to this article above.

Source code download is best http://hg.nginx.org/nginx/ download here. Hg can be used, but personally feel inconvenient.

The OpenSSL used is 1.1.0h, zlib is 1.2.11, and pcre is 8.39

Nginx is 1.17.6

Enter the msys directory of the C drive, double-click msys.bat to open the window of mingw32

cd to nginx directory

Compile configuration commands

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

Then modify the file nginx source directory \ auto \ cc \ msvc, add a line NGX_MSVC_VER = 15.00 in front of echo "+ cl version: $ NGX_MSVC_VER"

Start compiling:

Open another cmd window

I am using VS2017 and execute the following command to initialize the environment.

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

#然后

nmake -f build/Makefile

#开始编译

 

Other references:

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

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

Published 17 original articles · praised 6 · 40,000+ views

Guess you like

Origin blog.csdn.net/wangjingkaibear/article/details/103560009