Project

General

Profile

Actions

Lighttpd with Coral Cache » History » Revision 2

« Previous | Revision 2/5 (diff) | Next »
moo, 2007-07-20 15:57


Using Lighttpd with Coral Cache

This quick howto shows what to add to your configuration file to take advantage of [http://www.coralcdn.org/ Coral Cache]. Coral Cache is a free content distribution network commonly used to survive being dugg/slashdotted.

Coral Cache Basics

Coral Cache is easy to use. Just add ".nyud.net:8080" to the end of any domain (e.g. http://www.google.com.nyud.net:8080), and everything else is handled for you. Of course, caching means that whatever content you cache becomes static. By default, content is cached for 12 hours, which is probably fine for most uses, epically if you only cache your images.

Config File Sample
Coral Cache builds its cache automatically, by requesting the content from your server. Because of this, we can't just redirect everything, we have to actually answer requests from Coral Cache. Coral Cache also has a fault-tolerance of sorts... If for some reason it can't handle the request, it sends the request back to your server. So, we have to test for this.

You will need mod_redirect enabled:

{{{
#!lighttpdconf
server.modules = ( "mod_redirect" )
}}}

Now, here's the meat & potatoes of the code (thanks to Freenode#lighttpd for the tips):

{{{
#!lighttpdconf
  1. make sure this isn't CoralCache requesting content
    $HTTP["useragent"] !~ "^CoralWebPrx" { # make sure that this wasn't sent back to us from CoralCache
    $HTTP["querystring"] !~ "(|&)coral-no-serve$" {
    url.redirect = ( "
    /(.*)" => "http://www.mysite.com.nyud.net:8080/$1" )
    }
    }
    }}}

Updated by moo over 17 years ago · 2 revisions