Latest News >> 2008-07-20 2008-06-25

I’ve been completely fed up with news/feed/rss/atom readers these days. I use Linux as my primary operating system, and I only have a few feeds that I want to rip through quick so I can get to reading the content. Yet, trying to find a reader that doesn’t suck donkey balls has been a chore.

2008-06-21

Wanna know what all the Ruby vulnerabilities are? Or at least have a fun look at how to search through code for clues? It’s a blast.

2008-06-13

I’m dropping a large blog post on everyone to just say that I haven’t died, I’ve just been busy working on my book for A/W about Mongrel. I had contracted with them to do a book about deploying Mongrel, but then decided it wouldn’t be a very good book since we’d already done one about that topic and there wasn’t too much more to say.

Lighttpd Configuration

You’ll need to tell lighttpd how to connect to your SCGI server. The nice thing is that the scgi_rails script knows how to fork itself to create a cluster for you, so all you need to do is point lighttpd at one port. Here’s the important parts of my configuration:

Make sure you have mod_scgi mentioned in the modules:

server.modules = ( "mod_rewrite", "mod_redirect", "mod_access", "mod_accesslog", "mod_compress", "mod_scgi" )

Tell lighttpd to route 404 errors to your SCGI server with this stupidity:

server.error-handler-404 = "/dispatch.scgi"

Next you have to tell lighttpd to route all requests for dispatch.scgi to SCGI and not to check for local.

scgi.server = ( "dispatch.scgi" => (( 
  "host" => "127.0.0.1",
  "port" => 9999,
  "check-local" => "disable" 
 )) )

What happens is lighttpd will check for a request in /public as a file, it doesn’t find a file so it runs the 404 handler. You’ve got /dispatch.scgi as the 404 handler, which is configured to then run 127.0.0.1:9999 SCGI server, which has check-local disabled. Then the bump on the frog on the log at the bottom of the ocean by the beach with the man with the tan will begin to work. Oh well, it’s much better than Apache’s configuration at least.

Then I turn on super debugging for fun:

scgi.debug=3

But make sure you turn this off in production. A common complaint people have is that lighttpd spams the lighttpd_error.log file with tons of connection messages and other stuff if debug=3. Set it to scgi.debug=0 for better messages in production.

NOTE: You do not need to create a public/dispatch.scgi file. This "file" is purely virtual in this configuration.

Cluster Configuration

Configuring a cluster under lighttpd is pretty easy. Here’s what I do:

scgi.server = ( "dispatch.scgi" => 
        ( 
        "server1" => 
                ( "host" => "127.0.0.1",
                "port" => 9999,
                "check-local" => "disable"),

        "server2" =>
                ( "host" => "127.0.0.1",
                "port" => 10000,
               "check-local" => "disable"),

        "server3" =>
                ( "host" => "127.0.0.1",
                "port" => 10001,
               "check-local" => "disable")
        )
)

This sets up three backends to handle the requests, with the first one getting the majority of the requests. You can even put these on different machines and set them up however you like.