Hunter的大杂烩 技术学习笔记

2018-02-05

nginx windows下编译兼支持taobao mod_concat

Filed under: 技术话题 — hunter @ 6:02 pm

参考:
http://nginx.org/en/docs/howto_build_on_win32.html
http://blog.csdn.net/felixking/article/details/51981794?utm_source=itdadao&utm_medium=referral
http://blog.csdn.net/i348018533/article/details/51701865

几个注意事项:
1. 官网下载的release代码包是不能在windows下编译的,一定要装mercurial,从代码仓库里面checkout一份出来;
2. nginx不支持windows下64bit的编译;

编译过程基本如官网指引
1. 安装msys(无需安装MinGW)和activeperl(如果不需要支持ssl,则连perl也可以免)
2. 下载依赖库
3. 按官网指引,解压到 objs/lib 下面
4. 到http://tengine.taobao.org/ 上下载一个tengine的源码,从里面找到最新的ngx_http_concat_module.c
5. 到https://github.com/alibaba/nginx-http-concat 上下载http_concat的config文件,以便能和nginx一起编译。(github上的http_concat模块跟淘宝tengine的基本一致,就2行不同,有兴趣的朋友可以自行diff)
6. 在objs/lib下建module目录,将ngx_http_concat_module.c和config文件都放进去;
7. 中文windows的朋友,要在 nginx\auto\cc\msvc 第16行,加一条 NGX_MSVC_VER=16.00 (具体VC版本号按实际情况改,参考文件头部注释)
8. 在开始菜单中,找到visual studio tools目录,运行下面的 “visual studio 命令提示”,这个命令提示会将相关环境变量设置好,不要运行上面的“x64命令提示”,会有很多麻烦。
9. 在打开的dos窗口内,运行msys.bat,打开msys环境
10.进入nginx代码目录,运行
auto/configure –with-cc=cl –builddir=objs –prefix= –sbin-path=nginx.exe –conf-path=conf/nginx.conf \
–pid-path=logs/nginx.pid –http-log-path=logs/access.log –error-log-path=logs/error.log \
–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-select_module –with-cpu-opt=pentium4 \
–with-http_realip_module –with-http_addition_module –with-http_sub_module –with-http_ssl_module \
–with-http_gzip_static_module  –add-module=objs/module –with-http_stub_status_module \
–with-pcre=objs/lib/pcre-8.41 –with-zlib=objs/lib/zlib-1.2.11 –without-http_autoindex_module –with-openssl=objs/lib/openssl-1.0.2n  –with-openssl-opt=no-asm
11.最后编译,就大功告成~~~

本人编译的1.13.8版本win32 nginx

1. 支持ssl、http_concat 下载地址

2. 仅支持http_concat,下载地址

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress