Nginx 安装 lua-nginx-module 模块

Nginx的看家本领就是速度,Lua的拿手好戏亦是速度,这两者的结合在速度上无疑有基因上的优势。nginx_lua_module是由淘宝的工程师清无(王晓哲)和春来(章亦春)所开发的nginx第三方模块,它能将lua语言嵌入到nginx配置中,从而使用lua就极大增强了nginx的能力

下载LuaJIT

# cd /usr/local/src
# git clone https://github.com/openresty/luajit2.git
# cd luajit2
# make
# make install PREFIX=/usr/local/luajit

下载ngx_devel_kit

# git clone https://github.com/simplresty/ngx_devel_kit.git

下载lua-nginx-module

# git clone https://github.com/openresty/lua-nginx-module.git

导入LuaJIT环境变量

# export LUAJIT_LIB=/usr/local/luajit/lib
# export LUAJIT_INC=/usr/local/luajit/include/luajit-2.1

编译nginx

# cd /usr/local/src
# wget http://nginx.org/download/nginx-1.10.3.tar.gz
# tar zxvf nginx-1.10.3.tar.gz
# cd nginx-1.10.3
# ./configure --prefix=/usr/local/nginx \
--user=nginx --group=nginx \
--with-http_ssl_module \
--with-http_spdy_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-pcre \
--with-ipv6 \
--with-ld-opt=-Wl,-rpath,/usr/local/luajit/lib \
--add-module=../ngx_devel_kit \
--add-module=../lua-nginx-module