I am trying to set up virtual hosting to support both domain, and subdomain (like http://mysite.com, and http://blog.mysite.com). The following lighttpd config file works half of times for me, and the other half, I see error on the server.
My lighttpd config file looks like this:
server.modules += ( "mod_fastcgi" )
server.modules += ( "mod_rewrite" )
server.modules += ( "mod_redirect" )
server.modules += ( "mod_alias" )
server.modules += ("mod_evhost")
server.document-root = "/var/www/mysite.com"
# regex to match subdomain blog.mysite.com
$HTTP["host"] =~ "^[^.]+\.[^.]+\.[^.]+$" {
evhost.path-pattern = "/var/www/%0/%3/"
fastcgi.server = ( ".py" => (
"blog-python-fcgi" =>
(
"socket" => "/tmp/mysite-blog-fcgi.sock",
"bin-path" => "/var/www/mysite.com/blog/main.py",
"check-local" => "disable",
"max-procs" => 1
)
)
)
}
# regex to match mysite.com
$HTTP["host"] =~ "^[^.]+\.[^.]+$" {
evhost.path-pattern = "/var/www/%0/"
fastcgi.server = ( ".py" => (
"main-python-fcgi" =>
(
"socket" => "/tmp/mysite-fcgi.sock",
"bin-path" => "/var/www/mysite.com/main.py",
"check-local" => "disable",
"max-procs" => 4
)
)
)
}
This is the error I get more than half the times on the server:
2011-10-31 11:20:13: (mod_fastcgi.c.1734) connect failed: Connection refused on unix:/tmp/mysite-fcgi.sock-2
2011-10-31 11:20:13: (mod_fastcgi.c.3037) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 2
2011-10-31 11:20:13: (mod_fastcgi.c.2816) child signaled: 9
2011-10-31 11:20:25: (mod_fastcgi.c.2582) unexpected end-of-file (perhaps the fastcgi process died): pid: 22270 socket: unix:/tmp/mysite-fcgi.sock-2
2011-10-31 11:20:25: (mod_fastcgi.c.3324) child signaled: 9
2011-10-31 11:20:25: (mod_fastcgi.c.3367) response not received, request sent: 852 on socket: unix:/tmp/mysite-fcgi.sock-2 for /main.py?, closing connection
2011-10-31 11:20:26: (mod_fastcgi.c.1734) connect failed: Connection refused on unix:/tmp/mysite-fcgi.sock-3
and for some reason, lighttpd tries to access the "www" folder inside "mysite.com", a setting which I have not specified.
2011-10-31 11:52:47: (mod_evhost.c.319) No such file or directory /var/www/mysite.com/www/
Why am I getting these errors, and how can I solve them.