I've got lighttp configured to start and serve django via fastcgi on ubuntu. When I have only a single site enabled (via ubuntu's apache-like conf-available, conf-enabled mechanism), everything runs beautifully. When I enable a second site, my url rewrites seem to stop working correctly, though the fcgi processes are started and serving data. Here's my configuration:
conf-available/10-example.conf
$HTTP["host"] == "example.com" {
var.virt_name = "example"
include "includes/incl-fastcgi.conf"
}
includes/incl-fastcgi.conf
global {
server.modules += ("mod_rewrite",
"mod_fastcgi")
}
var.site_folder = "/" + virt_name
var.site_root = server_root + site_folder
var.socket = server_root + "/.handles/" + virt_name + ".socket"
server.document-root = site_root
fastcgi.server = (
"/django.fcgi" => (
"main" => (
"socket" => socket,
"bin-path" => "/etc/lighttpd/scripts/fcgi.sh",
"bin-environment" => ( "VIRT" => virt_name, ),
"check-local" => "disable",
"min-procs" => 1,
"max-procs" => 1,
"allow-x-send-file" => "enable",
),
),
)
alias.url = (
"/media/admin" => "/usr/share/python-support/python-django/django/contrib/admin/media", #why the hell does it live here?
)
url.rewrite-once = (
"^(/media.*)$" => "$1",
"^/favicon\.ico$" => "/media/favicon.ico",
"^/robots\.txt$" => "/robots.txt",
"^(/.*)$" => "/django.fcgi$1",
)
When I enable the second site, everything is identical except that now there's a second link to a (slightly modified) copy of 10-example.conf
in conf-enabled. When this happens, my sites fail with this django-served error:
Page not found (404)
Request Method: GET
Request URL: http://example.com/django.fcgi/[the url I requested]
I'm not sure why enabling another site should break the existing setup. I believe the host-based syntax should isolate any changes to that specific host, but it does not seem to be the case.