linkies

mod_wombat: Lua in Apache2

Apache mod_wombat embeds the Lua scripting language in the Apache HTTP Server. Lua, with mod_wombat, lets you efficiently script the multi-threaded worker and event multiprocess modules for Apache 2.

require 'apache2'
require 'math'

s = r:document_root() .. "%d.html"

function rewrite_index(r)
  if r.uri == "/index.html" then
    r.filename = s:format(math.random(5))
    r:debug("sending " .. r.filename)
    return apache2.OK
  end
  return apache2.DECLINED
end
        

Copyright © 2008 The Apache Software Foundation