Nginx & Lua: Hacks, optimizations & observations

luanginxreverse-proxyscriptingweb-server

Following this post on using Lua to increase nginx’s flexibility and in reducing load on the web stack I am curious to know how people are using Lua to enhance nginx’s capability.

Are there any notable hacks, optimizations & observations using Lua? Hacks that people have used to discover capability with Nginx that would otherwise be complicated/impossible with a webserver or reverse proxy?

Edit:
Links:
http://thechangelog.com/post/3249294699/super-nginx-killer-build-of-nginx-build-for-luajit-plus
http://skillsmatter.com/podcast/home/scripting-nginx-with-lua/te-4729
http://devblog.mixlr.com/2012/06/26/how-we-use-nginx-lua-and-redis-to-beta-ify-mixlr/

Best Answer

Earlier we've written a solution that dynamically gets the document root based on the domain or domain alias specified. It uses a mysql database to store domainname to alias mappings. The link to it is http://www.logicwreck.com/index.php/2012/09/11/dynamic-hosts-for-nginx-with-database-storage-of-domain-and-alias-info/
A pretty interesting hack as it can prevent you from having multiple configured virtual hosts, and have just one instead.