开源软件名称:lua-var-nginx-module
开源软件地址:https://gitee.com/iresty/lua-var-nginx-module
开源软件介绍:
lua-var-nginx-moduleFetchs Nginx variable by Luajit with FFI way which is fast and cheap. Compares to ngx.var.* , performance has increased by more than five times. ^_^ Table of ContentsInstallCompiles the nginx c module to OpenResty: ./configure --prefix=/opt/openresty \ --add-module=/path/to/lua-var-nginx-module Install the Lua source code, there are two ways: luarocks install lua-resty-ngxvar Or we can copy the source lua file to specified directory which OpenResty canload it normally. make install LUA_LIB_DIR=/opt/openresty/lualib/ Methodrequestsyntax: req = ngxvar.request()
Returns the request object of current request. We can cache it at your Lua codeland if we try to fetch more than one variable in one request. Back to TOC fetchsyntax: val = ngxvar.fetch(name, req)
Returns the Nginx variable value by name. location /t { content_by_lua_block { local var = require("resty.ngxvar") local req = var.request() ngx.say(var.fetch("host", req)) ngx.say(var.fetch("uri", req)) } } Back to TOC TODOBack to TOC |
请发表评论