9951 explained code solutions for 126 technologies


nginx-luaHow to include Lua code from file


Nginx will cache Lua code from specified file once reloaded. If you want Nginx to load code dynamically, you need to disable Lua code cache.

server {
  location /test {
    content_by_lua_file /path/to/script.lua;
  }
}ctrl + c
content_by_lua_file

nginx-lua directive to load code from specified Lua code file

/path/to/script.lua

path with Lua code to load and execute