[Catalyst] Tip: Serving Static Files with lighttpd

Bernhard Graf catalyst2 at augensalat.de
Fri Apr 20 09:05:54 GMT 2007


Wherever I looked I only found advice how to serve static files with 
Apache.

Here is the same for lighttpd:

First assign your document root (server.document-root /
simple-vhost.server-root / evhost.path-pattern)

Then, assumed your FastCGI configuration looks like this:

    fastcgi.server = (
        "" => (
            "MyApp" => (
                "socket"       => "/tmp/myapp.socket",
                "check-local"  => "disable",
            )
        )
    )

If you want everything in /static to be served by lighttpd directly 
enclose the above in

    $HTTP["url"] !~ "^/static/" { ... }

Here is a complete example that serves favicon.ico and everything 
in /img and /css by lighttpd:

    $HTTP["url"] !~ "^/(?:img/|css/|favicon.ico$)" {
        fastcgi.server = (
            "" => (
                "MyApp" => (
                    "socket"       => "/tmp/myapp.socket",
                    "check-local"  => "disable",
                )
            )
        )
    }

Enjoy the boost
-- 
Bernhard Graf



More information about the Catalyst mailing list