在windows下编译nginx
2016-02-22 15:45
585 查看
又有人在windows下编译nginx – 为什么那么多人喜欢自残呢?
官网教程
Building nginx on the Win32 platform with Visual C本文基本上就是对着做,但需要对其进行微调 – 不爽吗?咬我啊!!准备工具
系统: winxp sp3 32位, 例如你可以用个虚拟机什么的安装一个winxpMSYS-CN 2010-08-19 更新版本zlib 1.2.7pcre 8.32openssl 1.0.1eVS2008 Express With SP1Perl 5.16.3.1Subversion 或者你喜欢的svn客户端安装必要的程序
VS2008,附带的sqlserver无需安装,也用不上Perl,一直下一步即可Slik-Subversion,一直就是下一步将MSYS-CN解压到C盘下载源码
到C:\MSYS启动msys.bat,进入msys的bash非常重要哦, 官网的tar包是不包含windows构建文件的!!svn co svn://svn.nginx.org/nginx/tags/release-1.3.15 cd release-1.3.15 mkdir objs mkdir objs/lib然后, 把pcre/zlib/openssl的源码,均解压到C:\MSYS\home\UserName\release-1.3.15\objs\lib, 即上述语句所建立的文件夹,其中UserName是你的用户名.
生成构建脚本
依然在msys bash下.cd release-1.3.15 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语句比较长,可以写到build.bat中,然后执行 ./build.bat
编译
总有要编译啦,哇哈哈. 在开始菜单找VS2008的VS2008命令行,启动之执行下面的语句C: cd \MSYS\home\UserName\release-1.3.15\ nmake -f objs/Makefile你很快就会发现报错了,说找不到某某头文件.用你喜欢的编辑器打开 C:\MSYS\home\UserName\release-1.3.15\objs\lib\pcre-8.32\config.h找到并注释掉(加//):
#ifndef HAVE_INTTYPES_H #define HAVE_INTTYPES_H 1 #endif #ifndef HAVE_STDINT_H #define HAVE_STDINT_H 1 #endif然后再执行就成功了:
nmake -f objs/Makefile
好吧,祝你好运!!
C:\MSYS\home\Administrator\release-1.3.15>nginx.exe -V nginx version: nginx/1.3.15-http://wendal.net TLS SNI support enabled configure arguments: --with-cc=cl --builddir=objs --prefix= --conf-path=conf/ng nx.conf --pid-path=logs/nginx.pid --http-log-path=logs/access.log --error-log-p th=logs/error.log --sbin-path=nginx.exe --http-client-body-temp-path=temp/clien _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 --w th-zlib=objs/lib/zlib-1.2.7 --with-openssl=objs/lib/openssl-1.0.1e --with-selec _module --with-http_ssl_module
相关文章推荐
- nginx代理指定目录
- 访问Nginx发生SSL connection error的一种情况
- Nginx+Naxsi部署专业级Web应用防火墙
- CentOS 6.2实战部署Nginx+MySQL+PHP
- nginx中http核心模块的配置指令2
- nginx中http核心模块的配置指令3
- nginx中http核心模块的配置指令4
- nginx中http的fastcgi模块的配置指令1
- Nginx 学习笔记(一)
- 网站502与504错误分析
- 艰难完成 nginx + puma 部署 rails 4的详细记录
- 把Lua编译进nginx步骤方法
- web 应用中常用的各种 cache详解
- Linux系统上配置Nginx+Ruby on Rails+MySQL超攻略
- window+nginx+php环境配置 附配置搭配说明
- 解析CI即CodeIgniter框架在Nginx下的重写规则
- 将PHP从5.3.28升级到5.3.29时Nginx出现502错误
- 基于Nginx0.8.54+PHP5.3.4+MySQL5.5.8的全新LNMP稳定版架构搭建的VPS
- Nginx(PHP/fastcgi)的PATH_INFO问题