在Win32上用VC编译nginx

编译前准备

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

运行configure脚本生成编译文件

·        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

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值