C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\nmake.exerc.exe:编译工具,一般在 Windows Kits 中,我的路径是C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\rc.exe如果参考 nginx 官网文档的话还需要 MSYS 和 Mercurial client,但是我编译时候没用,后文附官方文档链接
直接去 http://hg.nginx.org/nginx 上下载源码,解压之后的文件目录结构是:

在解压的文件夹中新建 objs\lib 文件夹,然后将上面下载的依赖 openssl zlib PCRE 三个依赖以及你自己想要编译的模块比如我的是 nginx-http-flv-module 解压之后放到 objs\lib 文件夹中,如下:

Strawberry Perl GnuWin32-sed 环境变量
OpenSSL-Win32
nmake
rc.exe
nignx 主目录,(其中的prefix路径可以稍微改改,但是最好不要改,windows路径和linux不太一样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/pcre2-10.40 \
--with-zlib=objs/lib/zlib-1.2.13 \
--with-openssl=objs/lib/openssl-1.1.1s \
--with-openssl-opt=no-asm \
--with-http_ssl_module \
--add-module=objs/lib/nginx-http-flv-module
nignx 主目录nmake -f objs\Makefile
如果出现比如rc'不是内部或外部命令,也不是可运行的程序'等错误就是环境变量没配好
编译成功之后会在objs文件夹下出现nginx.exe可执行文件

另外运行nginx.exe出现创建文件失败错误的话,比如[alert] could not open error log file: CreateFile和 [emerg] 10888#16720: CreateDirectory()
只需要在nginx主目录下创建相应的文件夹,比如常见的文件有 temp logs 等