NGINX安装LUA(基于LNMP):

NGINX安装LUA(基于LNMP):

1.下载安装LuaJIT 2.1:http://luajit.org/download.html

wget http://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz
tar zxf LuaJIT-2.1.0-beta3.tar.gz
cd LuaJIT-2.1.0-beta3
make PREFIX=/usr/local/luajit
make install PREFIX=/usr/local/luajit 

2.下载最新的ngx_devel_kit(NDK)模块:https://github.com/simpl/ngx_devel_kit/tags

wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz
tar -xzvf v0.3.0.tar.gz 

3.下载最新的lua-nginx-module 模块:https://github.com/openresty/lua-nginx-module/tags

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

然后执行以下命令

# tell nginx's build system where to find LuaJIT 2.1:
export LUAJIT_LIB=/usr/local/luajit/lib 

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

https://www.jianshu.com/p/dbf51acbb8f3

nginx增加lua模块 yum install -y gcc g++ gcc-c++ zlib zlib-devel openssl openssl-devel pcre pcre-devel wget -c http://luajit.org/download/LuaJIT-2.0.4.tar.gz tar xzvf LuaJIT-2.0.4.tar.gz
cd LuaJIT-2.0.4 make install PREFIX=/usr/local/luajit
# 添加环境变量
export LUAJIT_LIB=/usr/local/luajit/lib
export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0 ln -s /usr/local/luajit/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2 #不增加这行,nginx启动会报错 mkdir -p /opt/modules wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz tar -xzvf v0.3.0.tar.gz

cd /opt/modules wget https://github.com/openresty/lua-nginx-module/archive/v0.10.8.tar.gz tar -xzvf v0.10.8.tar.gz

cd /opt/modules wget http://nginx.org/download/nginx-1.10.3.tar.gz tar -xzvf nginx-1.10.3.tar.gz
cd nginx-1.10.3 ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-cc-opt=-O3 --with-stream --add-module=/opt/modules/ngx_devel_kit-0.3.0 --add-module=/opt/modules/lua-nginx-module-0.10.8 make make install
https://www.cnblogs.com/uglyliu/p/8534473.html





    上回在安装nginx+lua时过程中,在执行./configure命令时提示错误: error: ngx_http_lua_module requires the Lua library,而我确实已经安装luajit(LuaJIT:LuaJIT is a Just-In-Time Compiler (JIT) for the  Lua programming language. lua的高效率版本)。在执行.configure时也导入了export LUAJIT_LIB和export LUAJIT_INC的目录路径。如下:

export LUAJIT_LIB=/opt/modules/luajit/lib
export LUAJIT_INC=/opt/modules/luajit/include/luajit-2.0

    最后找到解决办法:先安装lua-devel。可使用命令:

yum install lua-devel

https://blog.csdn.net/ygm_linux/article/details/81584382



https://www.cnblogs.com/yulibostu/articles/10529989.html


发表评论 / Comment

用心评论~