1、下载LuaJit
# wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz
2、编译安装
# tar xzvf LuaJIT-2.0.5.tar.gz
# cd LuaJIT-2.0.5
# make PREFIX=/opt/programs/nginx_1.12.2/lua/luajit
# make install PREFIX=/opt/programs/nginx_1.12.2/lua/luajit
二、下载 ngx_devel_kit (NDK)
# wget https://github.com/simplresty/ngx_devel_kit/archive/v0.3.0.tar.gz
# tar xzvf v0.3.0.tar.gz
三、下载 ngx_lua
# wget https://github.com/openresty/lua-nginx-module/archive/v0.10.11.tar.gz
# tar xvf v0.10.11.tar.gz
四、查看之前编译参数
#./nginx -V
nginx version: nginx/1.12.2
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/opt/programs/nginx_1.12.2 --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module --with-threads --with-http_v2_module --with-http_addition_module --with-http_dav_module --with-file-aio --with-http_gunzip_module --add-module=nginx_upstream_check_module-master
五、集成添加lua
# export LUAJIT_LIB=/opt/programs/nginx_1.12.2/lua/luajit/lib
# export LUAJIT_INC=/opt/programs/nginx_1.12.2/lua/luajit/include/luajit-2.0
# ./configure --prefix=/opt/programs/nginx_1.12.2 --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module --with-threads --with-http_v2_module --with-http_addition_module --with-http_dav_module --with-file-aio --with-http_gunzip_module --add-module=nginx_upstream_check_module-master --with-ld-opt="-Wl,-rpath,/opt/programs/nginx_1.12.2/lua/luajit/lib" --add-module=/opt/programs/nginx_1.12.2/lua/ngx_devel_kit-0.3.0/ --add-module=/opt/programs/nginx_1.12.2/lua/lua-nginx-module-0.10.11/
# make
# cp /opt/programs/nginx_1.12.2/sbin/nginx /opt/programs/nginx_1.12.2/sbin/nginx.bak 备份
# service nginx stop
#cp objs/nginx /opt/programs/nginx_1.12.2/sbin/
cp: overwrite ‘/opt/programs/nginx_1.12.2/sbin/nginx’? y
# nginx -V 检查模块是否添加上
|
请发表评论