nginx需要安装的模块支持:
HttpSetMiscModule 让nginx支持sha1\md5等.
HttpLuaModule 让nginx 支持Lua语言,进行模块编程.
一、下载luajit 2.0并安装
http://luajit.org/download.html
tar zxf LuaJIT-2.0.3.tar.gz
cd LuaJIT-2.0.3
make && make install PREFIX=/usr/local/luajit
export LUAJIT_LIB=/usr/local/luajit/lib
export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0
二、下载Nginx扩展
1:下载 ngx_devel_kit
https://github.com/simpl/ngx_devel_kit/tags(NDK), 解压至/usr/local/nginx_module/ngx_devel_kit
2:下载 lua-nginx-module
https://github.com/openresty/lua-nginx-module/tags 解压至/usr/local/nginx_module/lua-nginx-module
3:下载 set-misc-nginx-module
https://github.com/openresty/set-misc-nginx-module/tags 解压至/usr/local/nginx_module/set-misc-nginx-module
三、Nginx平滑升级
cd tengine-2.0.3 /usr/local/nginx/sbin/nginx -V
Tengine version: Tengine/2.0.3 (nginx/1.4.7) built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx
./configure --prefix=/usr/local/nginx --with-ld-opt="-Wl,-rpath,$LUAJIT_LIB" --add-module=/usr/local/nginx_module/ngx_devel_kit --add-module=/usr/local/nginx_module/lua-nginx-module --add-module=/usr/local/nginx_module/set-misc-nginx-module --add-module=/usr/local/nginx_module/set-misc-nginx-module
make -j2
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
cp objs/nginx /usr/local/nginx/sbin/
文档可参考:
http://wiki.nginx.org/HttpSetMiscModule 含安装及API和示例
http://wiki.nginx.org/HttpLuaModule 含安装及API和示例
http://blog.csdn.net/chosen0ne/article/details/7304192 基本用法及非阻塞子请求
http://blog.csdn.net/vboy1010/article/details/7868645 nginx_lua_module、echo-nginx-module模块安装