编译前准备
1、编译器,Microsoft VisualStudio® 8 或 10支持编译,网上有VC8支持不够好的案例;
2、Bash命令执行外壳程序,下载MSYS(http://www.mingw.org/wiki/MSYS)并安装;
3、Perl脚本运行环境,如果把OpenSSL编译进来以便支持SSL,需要下载安装ActivePerl(http://www.activestate.com/activeperl) 或Strawberry Perl(http://strawberryperl.com/);
4、下载•Mercurial 客户端,http://mercurial.selenic.com/;
5、下载•PCRE, zlib 和OpenSSL的C语言库文件:
PCRE:http://www.pcre.org/
Zlib:http://zlib.net/
OpenSSL:http://www.openssl.org/。
6、配置PATH:Perl、MSYS、Mercurial安装路径下执行文件所在路径加入到PATH环境变量,VC的环境变量设置可以运行VC安装目录下的vcvarsall.bat配置。
7、运行MSYS;
8、从hg.nginx.org上检出源码:hg clone http://hg.nginx.org/nginx
9、创建编译目录和lib库文件目录,并把下载的库文件拷贝到该目录:
• mkdir objs
• mkdir objs/lib
• cd objs/lib
• tar -xzf ../../pcre-8.32.tar.gz
• tar -xzf ../../zlib-1.2.7.tar.gz
• tar -xzf ../../openssl-1.0.1e.tar.gz
· 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.32 \
--with-zlib=objs/lib/zlib-1.2.7--with-openssl=objs/lib/openssl-1.0.1e \
--with-select_module--with-http_ssl_module --with-ipv6
运行nmake完成编译
nmake -f objs/Makefile