环境
系统:CentOS 7.5
准备
编译安装LuaJIT
-
编译安装
# tar -xzvf LuaJIT-2.0.5.tar.gz # cd LuaJIT-2.0.5 # make # make install
下载ngx_devel_kit
-
解压
# tar -xzvf ngx_devel_kit-0.3.0.tar.gz
下载lua-nginx-module
-
下载
地址:https://github.com/openresty/lua-nginx-module/releases -
解压
# tar -xzvf lua-nginx-module-0.10.13.tar.gz
重新编译安装Nginx
-
查看原来编译参数
# nginx -V ...... configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-stream
-
添加Lua扩展,重新编译安装
# export LUAJIT_LIB=/usr/local/lib # export LUAJIT_INC=/usr/local/include/luajit-2.0 # cd nginx-1.12.1/ # ./configure \ --prefix=/usr/local/nginx \ --with-http_ssl_module \ --with-http_stub_status_module \ --with-stream \ --add-module=/usr/local/src/ngx_devel_kit-0.3.0 \ --add-module=/usr/local/src/lua-nginx-module-0.10.13 # make # make install
-
重启
# nginx -t # systemctl restart nginx
其它
-
问题
# nginx -t nginx: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory
解决办法
# ln -s /usr/local/lib/libluajit-5.1.so.2 /lib64/
网友评论