- The *bylua modules that tweak the nginx behaviour (for ex the rewriteby_lua that is the lua equivalent of nginx http rewrite) module are always run after the standard nginx modules.
- The choice of *bylua module to use largely depends upon the problem that you are trying to solve. For example the initbylua module is used for initialization operations where as accessbylua may be used to implement access policies for a location block. Personally among the various directives I find most use for contentby_lua.
Lua can access nginx at different phase, the most important directives are:
Rememeber to set luacodecache when developing
ngx.location.capture to issue a sub-request to other locations in nginx
ngx.ctx is a lua table to store data with a lifetime