I’m delighted to announce the ngx_lua v0.1.4 release which features
the ability to disable the Lua code cache to ease Lua development. You
can get the release tarball from the download page:
By default, Lua code loaded into the ngx_lua module will be cached
(the compiled/JIT’d form will be cached). So changing .lua files
requires reloading or restarting the nginx server. From this release,
we can use the following directive to disable the code cache:
Then the Lua files referenced in set_by_lua_file, content_by_lua_file,
access_by_lua_file, and rewrite_by_lua_file won’t be cached at all,
and Lua’s “package.loaded” table will be cleared at every request’s
entry point (such that Lua modules won’t be cached either). So
developers and enjoy the PHP-way, i.e., edit-and-refresh.
But please note that Lua code inlined into nginx.conf like those
specified by set_by_lua, content_by_lua, access_by_lua, and
rewrite_by_lua will always be cached because only nginx knows how to
parse nginx.conf and the only way to tell it to re-load the config
file is to send a HUP signal to it or just to restart it from scratch.
For now, ngx_lua does not support the “stat” mode like Apache’s
mod_lua, but we will work on it in the future.
This release also contains a small over-all optimization that the keys
used for Lua code cache lookups are pre-calculated at config time
The ngx_lua module embeds the Lua/LuaJIT interpreter into the nginx
core and integrates the powerful Lua threads (aka Lua coroutines) into
the nginx event model by means of nginx subrequests.
You can get the latest source code and full documentation from the
ngx_lua’s project page: