lightthpd configuration

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

lightthpd configuration

Nick
Hi,

I've decided to use lighttpd as front-end server to Gemstone using FastCGI. I've based my lighhttpd config on Miguel's: http://miguel.leugim.com.mx/index.php/2008/09/27/gemstones-and-fastcgi-with-lighttpd/

In addition to Miguel's script I wanted to add support for serving static files (images, javascript etc) directly through lighttpd rather than through WAFileLibrary derived objects within Gemstone. I tried to replicate the Apache setup document in the Seaside book: http://book.seaside.st/book/advanced/deployment/deployment-apache/serving-files If I understand correctly, the configuration makes Apache  first look in the file system for the file, if it doesn't find it there it will pass the request on to Seaside. 
Unfortunately I couldn't replicate that setup with lighttpd, my best attempt enables me to serve files out of a specified directory - "/files/" - which I think will be adequate. I'm also using lighttpd to prevent access to /config and /tools/ unless the request comes from localhost. By this means I can prevent general access to /config and /tools, but when I connect via an ssh tunnel  (see http://selfish.org/blog/easy%20remote%20gemstone) to my server I can browse localhost and access "/config" and "/tools/"

Here's my configuration - it's mostly based on the defaults. I'm very interested to hear if anyone has other thoughts on static file serving:

server.modules  = ( "mod_access", "mod_alias", "mod_accesslog", "mod_fastcgi", "mod_compress")
server.document-root  = "/var/www/"
server.errorlog            = "/var/log/lighttpd/error.log"
index-file.names           = ( "index.html")
accesslog.filename         = "/var/log/lighttpd/access.log"
#debug.log-request-handling = "enable"
url.access-deny            = ( "~", ".inc" )
server.port               = 80
server.pid-file            = "/var/run/lighttpd.pid"
server.username            = "www-data"
server.groupname           = "www-data"
compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ("text/plain", "text/html", "application/x-javascript", "text/css")
## mimetype mapping
include_shell "/usr/share/lighttpd/create-mime.assign.pl"

$HTTP["url"] !~ "^/files/" {
#  fastcgi.debug=1
  fastcgi.server = ("/" =>(
    ("host" => "127.0.0.1", "port" => 9001, "check-local" => "disable"),
    ("host" => "127.0.0.1", "port" => 9002, "check-local" => "disable"),
    ("host" => "127.0.0.1", "port" => 9003, "check-local" => "disable")
   )
  )
}

$HTTP["url"] =~ "^/config|^/tools/" {
   # only allow access if coming through ssh tunneling
   $HTTP["remoteip"] != "127.0.0.1" {
     url.access-deny = ( "" )
   }
}


----
Nick