首页 > 代码库 > nginx lua整合安装2

nginx lua整合安装2

安装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/openresty/lua-nginx-module/archive/v0.9.19.tar.gz

解压

tar xzvf v0.9.19.tar.gz

 

 

获取NDK

下载

wget https://github.com/simpl/ngx_devel_kit/archive/v0.2.19.tar.gz

 

解压

tar xzvf v0.2.19.tar.gz

 

  

 

安装ngnix

卸载nginx

cd /usr/local/nginx

rm -rf nginx

 

下载:

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

 

解压:

tar zxvf nginx-1.9.3.tar.gz

 

进入目录:

cd nginx-1.9.3

 

配置

./configure --add-module=../ngx_devel_kit-0.2.19/ --add-module=../lua-nginx-module-0.9.19/  --with-ld-opt="-L /usr/local/lib"  

 

 --with-ld-opt="-L /usr/local/lib"   是指定pcre的安装位置

 

make

make install

 

启动

/usr/local/nginx/sbin/nginx

 

关闭进程

ps -ef|grep nginx   # 第一个

kill -QUIT 主进程号 

 

重启

/usr/local/nginx/sbin/nginx -s reload

 

 

 

nginx lua整合安装2