I just set up fastcgi with lighty for django, but I'm getting the fcgi file path when it processes the url, e.g. 404 error at http://myserver.myhost.com/myproject.fcgi. It needs to route to / instead of /myproject.fcgi.
Lighty conf:
$HTTP["host"] =~ "myproject\.myhost\.com" {
fastcgi.server = (
".fcgi" => (
"localhost" => (
"bin-path" => "/var/www/myproject/myproject.fcgi",
"socket" => "/tmp/myproject.sock",
"check-local" => "disable",
"min-procs" => 2,
"max-procs" => 4,
)
),
)
alias.url = (
"/media" => "/usr/local/lib/python1.6/dist-packages/Django-1.2.1-py2.6.egg/django/contrib/admin/media/",
)
url.rewrite-once = (
"^(/media.*)$" => "$1",
"^/favicon\.ico$" => "/media/favicon.ico",
"^(/.*)$" => "/myproject.fcgi$1",
)
}
myproject.fcgi:
#!/usr/bin/python2.6
import sys, os
# Add a custom Python path.
sys.path.insert(0, "..")
# Switch to the directory of your project. (Optional.)
os.chdir("/var/www/myproject")
os.environ['DJANGO_SETTINGS_MODULE'] = "settings"
from django.core.servers.fastcgi import runfastcgi
runfastcgi(["method=threaded", "daemonize=false"])