当前位置:首页 > 服务器技术 > nginx

win8.1下vs2013编译nginx

我的环境是win8.1 + vs2013社区版

1、安装msys。

http://sourceforge.net/projects/mingw/files/ Installer文件夹下有mingw-get,安装之后,弹出的界面中选择msys即可安装msys。

2、下载 zlib、openssl和pcre

下的几个版本为:openssl-1.0.1j、pcre-8.32、zlib-1.2.8

解压到 $(NGINX_SOURCE)objslib 目录,这个$(NGINX_SOURCE)为nginx源码放置路径,例如D:Toolsnginx。

3、生成makefile

a) 启动vs 2013命令行。 通过vs 2013工具命令行启动msys,能省略配置cl路径的步骤。

b) 在上述命令行中启动msys。

C:Program Files (x86)Microsoft Visual Studio 12.0VC>cd /d C:MinGWmsys1.0

C:MinGWmsys1.0>msys.bat
c) 在msys控制台窗口中,运行配置脚本

$ cd /d/Tools/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.32 --with-zlib=objs/lib/zlib-1.2.8 --with-openssl=objs/lib/openssl-1.0.1j --with-select_module --with-http_ssl_module --with-ipv6

如果不想下载zlib(gzip模块需要)、pcre(rewrite模块需要)和openssl,可以修改一下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-select_module --without-http_rewrite_module --without-http_gzip_module

4、启动编译。

在编译之前,需要修改一下makefile,去掉CFLAGS中的-WX编译选项,否则vs2013会把警告当错误终止编译。

cd D:Toolsnginxnmake -f objsMakefile

5、运行nginx。

a) 把objsnginx.exe拷贝到上一级目录。

b) 创建文件夹logs、temp

c) 启动nginx.exe

以上就介绍了win8.1下vs2013编译nginx,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!