11.8K ·GitHub
What is this?
It embeds the Lua scripting language directly into NGINX, letting you handle HTTP requests with Lua code using directives like 'content_by_lua_block' instead of relying only on plain config or custom C modules.
Is this a standalone server or an NGINX add-on?
It is a C module that gets compiled directly into the NGINX source tree, not a separate server or something you can drop into an existing prebuilt binary.
How do I get this running in NGINX?
You rebuild NGINX from source with this module via './configure --add-module=/path/to/lua-nginx-module', or use the OpenResty bundle which already ships it precompiled.
Do I need LuaJIT or anything else before building this?
Yes — you need LuaJIT (or standard Lua 5.1) plus the ngx_devel_kit (NDK) module, both set up alongside the NGINX source before this module will compile.
Can I add this to an existing NGINX install without rebuilding?
No, NGINX modules like this are statically linked at build time, so you have to recompile NGINX from source whenever you add or update it.
What operating systems does this target?
It targets Linux and other Unix-like systems where NGINX typically runs; no native Windows build is mentioned.
What NGINX directives does this add?
It introduces Lua scripting directives such as content_by_lua_block, access_by_lua_block, and rewrite_by_lua_block, letting you run Lua code at different phases of request processing.
Is this the same thing as OpenResty?
No, OpenResty is a full NGINX distribution that bundles this module together with LuaJIT and other components; lua-nginx-module is the core piece OpenResty depends on.
Why use Lua here instead of writing a custom NGINX C module?
Lua scripts run inside NGINX's non-blocking event loop, giving you near-C performance for custom request logic without the complexity of writing and compiling a C module.
Which topics is it in?
nginx, web-server, scripting, middleware, lua, unix, reverse-proxy, high-performance, http, c, devops, backend