nginx lua的安装

2022年6月28日 240点热度 1人点赞 0条评论

0x1
# luajit下载
https://github.com/openresty/luajit2
# lua nginx下载
https://github.com/openresty/lua-nginx-module
# ngx_devel_kit 下载
0x2
make && make install  PREFIX=/usr/local/luajit-2.1   &&   ln -s /usr/local/luajit-2.1   /usr/local/luajit
# tell nginx's build system where to find LuaJIT 2.0:
export LUAJIT_LIB=/usr/local/luajit/lib
export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0
# 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
./configure --prefix=/opt/nginx \
--with-ld-opt="-Wl,-rpath,/path/to/luajit/lib" \
--add-module=/path/to/ngx_devel_kit \
--add-module=/path/to/lua-nginx-module
# lua下载到本地
./configure --prefix=/usr/local/tengine --add-module=modules/ngx_http_upstream_session_sticky_module/ --add-module=modules/ngx_http_upstream_check_module/ --with-stream --with-stream_realip_module --with-http_sub_module --add-module=modules/ngx_http_substitutions_filter_module/ --with-http_gunzip_module --with-ld-opt=-ljemalloc --with-ld-opt="-Wl,-rpath,/usr/local/luajit/lib" --add-module=/path/to/lua-nginx-module
0x3
  1. 高版本lua模块在nginx上编译后启动有问题,所以使用回低版本: v0.10.14
  2. tengine编译后使用set_by_lua_file报错如下:
    unknown directive "set_by_lua_file"

    但是content_by_lua没有问题,说明lua安装是成功的,经过排查是ngx_devel_kit没有编译导致

    ./configure --prefix=/usr/local/tengine --add-module=modules/ngx_http_upstream_session_sticky_module/ --add-module=modules/ngx_http_upstream_check_module/ --with-stream --with-stream_realip_module --with-http_sub_module --add-module=modules/ngx_http_substitutions_filter_module/ --with-http_gunzip_module --with-ld-opt=-ljemalloc --with-ld-opt="-Wl,-rpath,/usr/local/luajit/lib" --add-module=./lua-nginx-module-0.10.14/ --add-module=./ngx_devel_kit-0.3.1/

yuc

这个人很懒,什么都没留下

error: Content is protected !!