- 官网下载的源码包不支持windows编译的
- 克隆http://hg.nginx.org/nginx
- 下载zlib-1.2.8.tar.gz,pcre-8.36.tar.bz2,openssl-1.0.2d.tar.gz
- nginx目录下新建目录objs/lib,上面三个库解压到该目录
- 安装Perl,MinGW
- vc命令行进入C:\MinGW\msys\1.0\目录,执行msys.bat,弹出一个窗口,以下操作是在新窗口中输入的
- 进入nginx目录,执行
auto/configure --with-cc=cl --builddir=objs --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 --with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs/lib/pcre-8.36 --with-zlib=objs/lib/zlib-1.2.8 --with-select_module --with-http_ssl_module --with-openssl=objs/lib/openssl-1.0.2d
nmake -f objs/Makefile
- 编译错误:sha1-586.asm(1432) : error A2070:invalid instruction operands,解决办法,增加no-asm参数,执行ms\do_nasm,或者出现链接错误,make加上参数-a
具体修改修改nginx\auto\lib\openssl\makefile.msvc:
perl Configure VC-WIN32 no-asm no-shared --prefix=openssl $(OPENSSL_OPT)
ms\do_nasm
$(MAKE) -f ms\nt.mak -a
$(MAKE) -f ms\nt.mak install - 如果把警告当错误提示了,可以在执行第7步骤后修改objs/makefile,去掉-WX参数
- ok~
nginx 1.9.5 windows 编译
最新推荐文章于 2023-08-26 12:23:55 发布