httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Akins, Brian" <>
Subject Some ramblings on httpd config
Date Wed, 03 Jun 2009 15:08:19 GMT
Some ramblings from playing with other servers, particularly varnish and
lighttpd.  It would be interesting if we ditched the current configuration
system and just used lua.  I know this has been said before, but I've been
doing a bit of playing with mod_lua and I think it it actually doable.  We
just need to supply a bit more glue.

Some more suggestions based on this:

-dump the current idea of virtual servers.  This can be done
programmatically in lua:

 if r.hostname == "" then
     r.document_root = "/some/directory/

We may could provide a lua library to somewhat simulate the "current"

 require 'apache.httpd3.vhost'
 v = apache.httpd3.vhost:new()
 v.document_root = "/blah"
 v.servername = ""

-We really only need three "handlers": request handler (everything from
post_read to handler), filter(s), and log.  Once again some lua library
could simulate different phases, if desired.

-No need for rewrite, alias, etc.  Can all be done in plain lua.  I think
lua makes more sense that trying to do logic in mod_rewrite, anyway.

-"config" file is just a lua script:

 require 'apache.httpd3.server'
 require 'apache.httpd3.gzip'
 require 'apache.httpd3.cache'

 s = apache.httpd3.server:new()
 s.procs = 4
 s.threadpool_size = 256
 s.request_timeout = 30
 s.default_error_log = "/var/logs/error_log"

 function output_filter( r )
     apache.httpd3.gzip:do_gzip( r )
     apache.httpd3.cache:do_cache_stuff( r )

 function logger( r )
     -- log stuff
 function handler( r )
    -- do handler stuff
     set_output_handler(r, output_filter)
     set_logger(r, logger)

 s.default_logger = logger



This is possible with a very minimal httpd.conf and mod_lua today.  You just
use the httpd.conf to "bootstrap" the lua handler and register "empty"
handlers for most everything.

Brian Akins
Chief Operations Engineer
Turner Digital Media Technologies

View raw message