nginx lua模块安装

1、安装LuaJIT,LuaJIT为LuaJIT is a Just-In-Time Compiler (JIT) for the Lua programming language

wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz
tar -zxvf LuaJIT-2.0.5.gz && cd LuaJIT-2.0.5
make && make install PREFIX=/usr/local/luajit
#导入两个环境变量

export LUAJIT_LIB=/usr/local/luajit/lib
export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0

2、下载ngx_devel_kit、和lua-nginx-module

wget https://github.com/simplresty/ngx_devel_kit/archive/v0.3.1rc1.tar.gz
tar -xzvf ngx_devel_kit-0.3.1rc1.tar.gz

wget https://github.com/openresty/lua-nginx-module/archive/v0.10.14rc3.tar.gz
tar -xzvf v0.10.14rc3.tar.gz

按前一篇文章的步骤重新编译nginx即可,RedHat 6.6下安装nginx,配置HTTPS,注意在configure时候新增参数

./configure --sbin-path=/usr/local/sbin --with-http_stub_status_module --with-http_ssl_module --with-threads --with-stream --add-module=/root/ngx_devel_kit-0.3.1rc1 --add-module=/root/lua-nginx-module-0.10.14rc3
make -j4 && make install

启动nginx,如果有这个报错:nginx: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory

  可以通过这样的方式来解决

vi /etc/ld.so.conf

新增一条 /usr/local/luajit/lib

保存文件,执行ldconfig ,即可。

posted @ 2018-12-05 23:16  今夜通宵  阅读(3310)  评论(0编辑  收藏  举报