nginx lua整合安装

时间:2021-06-06 04:28:42

安装lua JIT

下载

wget http://luajit.org/download/LuaJIT-2.0.4.tar.gz

解压:

tar zxvf LuaJIT-2.0.4.tar.gz

进入目录:

cd LuaJIT-2.0.4

编译并安装

make install PREFIX=/usr/local/luajit

配置

vi /etc/profile

export LUAJIT_LIB=/usr/local/luajit/lib

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

source /etc/profile

链接

echo "/usr/local/luajit/lib" > /etc/ld.so.conf.d/usr_local_luajit_lib.conf

ldconfig

 

获取lua-nginx-module

下载

wget https://github.com/chaoslawful/lua-nginx-module/archive/v0.8.6.tar.gz

解压

tar xzvf v0.8.6.tar.gz

获取NDK

wget -c https://github.com/simpl/ngx_devel_kit/archive/v0.2.18.tar.gz

tar xzvf v0.2.18.tar.gz

安装ngnix

卸载nginx

cd /usr/local/nginx

rm -rf nginx

下载:

wget http://nginx.org/download/nginx-1.4.2.tar.gz

解压:

tar zxvf nginx-1.4.2.tar.gz

进入目录:

cd nginx-1.4.2

配置

./configure --add-module=../ngx_devel_kit-0.2.18/ --add-module=../lua-nginx-module-0.8.6/

#注意这里的目录

make

make install

注:lua模块不支持nginx 1.8.x