This is a very simple web app that just prints out "Hello world!" to the browser.
AddHandler lua-script .lua
function handle(r) r.content_type = "text/html" -- set the output to text/html r:puts("Hello world!") return apache2.OK end
If you are all about speed and don't care much for what httpd gets to do (especially if you don't even need anything in your access log), you can set this script up as a Quick Handler, and bypass everything that httpd does, for maximum speed:
LuaQuickHandler /var/www/index.lua quick_handler
function quick_handler(r) if r.uri == "/" then r.content_type = "text/html" -- set the output to text/html r:puts("Hello world!") return apache2.DONE -- we're DONE - skip logging and all the rest httpd does, for MAXIMUM SPEEEED end return apache2.DECLINED end