Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm planning to migrate an old website to django. Initially, I want to use django for the urls, and continue to use the old static website for everything else.

I have little experience of lighttpd, which my django host uses, so I need some help with the configuration.

For a default django install, the lighttpd configuration is:

# mydomain
$HTTP["host"] =~ "(^|\.)$" {
    fastcgi.server = (
        "/django.fcgi" => (
            "main" => (
                "socket" => env.HOME + "/projectname/projectname.sock",
                "check-local" => "disable",
    alias.url = (
        "/media" => env.HOME + "/projectname/media",

    url.rewrite-once = (
        "^(/media.*)$" => "$1",
        "^(/.*)$" => "/django.fcgi$1",

I've changed the line

"^(/.*)$" => "/django.fcgi$1",


"^(/news/.*)$" => "/django.fcgi$1",

so that django is only used for urls beginning /news/, but I don't know how to redirect everything else to the static website folder.

share|improve this question
up vote 4 down vote accepted

server.document-root = env.HOME + "/projectname/static" should do the trick. On a side note: Your rewrite pattern:

 "^(/news/.*)$" => "/django.fcgi$1",

should probably been written as:

"^/news/(.*)$" => "/django.fcgi$1",

That way the "/news/" part of the url doesn't get passed on to the django.

share|improve this answer
Thanks, that did the trick. – Alasdair Sep 3 '09 at 17:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.