It seems to me that it will be more maintainable to keep separate functions of my site in separate FCGI binaries. What I want is for requests like these:
http://mysite.com/funcA.fcgi
http://mysite.com/funcB.fcgi?action=go
To be redirected to the appropriate files:
/var/fcgi/funcA.fcgi
/var/fcgi/funcB.fcgi
So, in my lighttpd.conf file, I would need something like this:
fastcgi.server =
( ".fcgi" =>
(( "bin-path" => "/var/fcgi",
"socket" => "tmp/fcgi.sock",
"check-local" => "disable"
))
)
Or maybe it would have to be more like this:
fastcgi.server =
( "funcA.fcgi" =>
(( "bin-path" => "/var/fcgi/funcA.fcgi",
"socket" => "tmp/fcgi.sock",
"check-local" => "disable"
))
),
( "funcB.fcgi" =>
(( "bin-path" => "/var/fcgi/funcB.fcgi",
"socket" => "tmp/fcgi.sock",
"check-local" => "disable"
))
)
Or am I maybe missing something else altogether? I can only get lighttpd to start when there is a single binary being pointed to.
EDIT: To make sure I'm being clear: what I need is for a request like mysite.com/x.fcgi
to invoke /var/fcgi/x.fcgi
, and likewise a request to mysite.com/y.fcgi
to invoke /var/fcgi/y.fcgi
. It seems to be like this should be pretty straightforward, but I can't get a lighttpd configuration that makes this happen.
Also, I'm not using anything interpreted. These are compiled C++ binaries using the fcgi_stdio.h
header.
Would I perhaps need to use mod_rewrite?
Best Answer
So it looks to me like what I want to do is impossible, or at least not provided for under FCGI. When you invoke
www.mydomain.com/thing1.fcgi
, you're not startingthing1.fcgi
; that has already been done. What you're doing is sending a request to the infinitely-running FCGI process that you write, which almost certainly has a infinite loop right at the heart of it, waiting for requests. This is just the nature of FCGI, and a major distinction from the earlier CGI.Not a hard question to answer, once you understand how FCGI works. I guess I was just wishing.