lighttpd.conf

June 6th, 2006

I use lighttpd for development on my box. I am currently working with Ruby on Rails and PHP

For PHP I am using Code Igniter so the rewrite rule for the php subdomain reflects this. To see my configuration keep reading…

server.modules = (
                  "mod_rewrite",
                  "mod_access",
                  "mod_fastcgi",
                  "mod_accesslog",
                  "mod_compress",
                  "mod_expire" 
                 )

server.document-root = "/Users/kenny/Sites/standard/" 

server.port = 80

server.username  = "www" 
server.groupname = "www" 

mimetype.assign = (  
  ".css"        =>  "text/css",
  ".gif"        =>  "image/gif",
  ".htm"        =>  "text/html",
  ".html"       =>  "text/html",
  ".xml"        =>  "text/xml",
  ".jpeg"       =>  "image/jpeg",
  ".jpg"        =>  "image/jpeg",
  ".js"         =>  "text/javascript",
  ".png"        =>  "image/png",
  ".swf"        =>  "application/x-shockwave-flash",
  ".txt"        =>  "text/plain" 
)

compress.filetype = ("text/plain",
                     "text/html",
                     "text/css",
                     "text/javascript" 
                     )

static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" )
index-file.names = ( "index.html", "index.htm", "index.php" )

# Making sure file uploads above 64k always work when using IE or Safari
# For more information, see http://trac.lighttpd.net/trac/ticket/360
$HTTP["useragent"] =~ "^(.*MSIE.*)|(.*AppleWebKit.*)$" {
  server.max-keep-alive-requests = 0
}

$HTTP["host"] == "php.localhost" {
   server.document-root = "/Users/kenny/Sites/php/" 
   url.rewrite = ( "^/$" => "index.php", "^([^.]+)$" => "index.php/$1" )
   fastcgi.server = ( ".php" => ((
                        "bin-path"  => "/usr/local/bin/php",
                        "socket"    => "/tmp/php.socket",
                        "max-procs" => 2,
                        "bin-environment" => (
                           "PHP_FCGI_CHILDREN"     => "16",
                           "PHP_FCGI_MAX_REQUESTS" => "10000" 
                        ),
                        "bin-copy-environment" => (
                           "PATH", "SHELL", "USER" 
                        ),
                        "broken-scriptfilename" => "enable" 
                     )))
}

$HTTP["host"] == "rails.localhost" {
  server.document-root = "/Users/kenny/Sites/rails/public" 
  server.indexfiles = ( "index.html" )
  server.error-handler-404 = "/dispatch.fcgi" 
  url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )
  compress.cache-dir = "/Users/kenny/Sites/rails/tmp/cache" 
  expire.url =   ("/favicon.ico"    => "access 3 days",
                  "/images/"        => "access 3 days",
                  "/stylesheets/"   => "access 3 days",
                  "/javascripts/"   => "access 3 days" 
                 )

  # rails stuff
  #### fastcgi module
  fastcgi.server = (
    ".fcgi" => (
      "rails" => (
        "socket" => "/tmp/rails.socket",
        "bin-path" => "/Users/kenny/Sites/rails/public/dispatch.fcgi",
        "min-procs" => 1,
        "max_procs" => 2
      )
    )
  )
}

5 Responses to “lighttpd.conf”

  1. ryan headley Says:
    Hey man, thanx for that php section. It was exaclty what I was looking for. Its such a pain having to support so many environments: PHP4, PHP5, Rails, Java, Python, etc, etc...
  2. qajj1ixijg Says:

    agpgasmo 307i193v2rgbvk81m x8z86nxj

  3. Thomas1 Says:

    http://cialisviagraonlinepharmacyzql.blogspot.com http://howtobuyphentermineowq.blogspot.com http://isvicodinaddictingaqu.blogspot.com http://adipex375mgtabletncr.blogspot.com http://kgr100viagranhm.blogspot.com http://percocetvicodinvsndq.blogspot.com http://cheaptramadol300ct50mgnoprjm.blogspot.com http://modelworkshopssomasanfrancjvs.blogspot.com

  4. Wei Zhang Says:

    This is a awesome note, thank you very much

  5. Madeline Nixon Says:

    1ckz2nh8mvjt3731

Leave a Reply