Reputation: 4115
I am trying to run my Django application through lighttpd with mod_fscgi
. Unfortunately it keeps throwing error i cant determine.
Here is the config:
cat /etc/lighttpd/lighttpd.conf
server.modules = (
"mod_expire",
"mod_setenv",
"mod_redirect",
"mod_rewrite",
"mod_compress",
"mod_access",
"mod_auth",
"mod_secdownload",
"mod_accesslog",
"mod_fastcgi",
# "mod_geoip"
)
server.document-root = "/var/www/default"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/www/logs/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 80
index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
expire.url = ("/img/" => "access plus 10 days")
$HTTP["host"] =~ “mydomain\.com” {
server.document-root = "/var/www/servers/mydomain.com/awesomesite"
accesslog.filename = "/var/www/logs/mydomain.com/access.log"
server.errorlog = "/var/www/logs/mydomain.com/error.log"
fastcgi.server = (
".fcgi" => (
"localhost" => (
# Use host / port instead of socket for TCP fastcgi
# "host" => "127.0.0.1",
# "port" => 3033,
"bin-path" => "/var/www/servers/mydomain.com/awesomesite/mydomain.fcgi",
"socket" => "/tmp/mydomain.sock",
"check-local" => "disable",
"min-procs" => 2,
"max-procs" => 4,
)
)
)
}
# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
The error:
/var/www/logs/mydomain.com# cat error.log
2014-03-10 09:01:26: (log.c.166) server started
2014-03-10 09:01:26: (mod_fastcgi.c.1103) the fastcgi-backend /var/www/servers/mydomain.com/awesomesite/mydomain.fcgi failed to start:
2014-03-10 09:01:26: (mod_fastcgi.c.1107) child exited with status 13 /var/www/servers/mydomain.com/awesomesite/mydomain.fcgi
2014-03-10 09:01:26: (mod_fastcgi.c.1110) If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.
If this is PHP on Gentoo, add 'fastcgi' to the USE flags. mydomain
2014-03-10 09:01:26: (mod_fastcgi.c.1397) [ERROR]: spawning fcgi failed.
2014-03-10 09:01:26: (server.c.976) Configuration of plugins failed. Going down.
The FCGI file:
cat /var/www/servers/mydomain.com/awesomesite/mydomain.fcgi
#!/usr/bin/env python
import sys, os
sys.path.insert(0, "/var/www/servers/mydomain.com")
os.environ['DJANGO_SETTINGS_MODULE'] = "awesomesite.settings"
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
Upvotes: 0
Views: 2010
Reputation: 2061
FastCGI is trying to execute the script specified in bin-path
. Make sure that the script /var/www/servers/mydomain.com/awesomesite/mydomain.fcgi
has the execution flag set by issuing:
ls -l /var/www/servers/mydomain.com/awesomesite/mydomain.fcgi
and verify that the x
flag is set for the user and/or group that the webserver/fastCGI runs as.
Upvotes: 1