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:


To be redirected to the appropriate files:


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?


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 starting thing1.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.


https://redmine.lighttpd.net/projects/1/wiki/docs_modfastcgi It can be done, several binaries in a lighttpd config.

  • Welcome to Server Fault! Your answer suggests a workable solution to the question is available via another website. The Stack Exchange family of Q&A websites generally frowns on this type of answer. Please read How do I write a good answer? and consider revising your answer to include the steps required to resolve the issue. And don't forget to take the site tour. – Paul Oct 30 '16 at 14:05
  • I was working on a lighttpd configuration with two binaries, here you have: – EDUARDO J YANEZ PRADO Oct 30 '16 at 17:39
  • $HTTP["host"] == "localhost" { fastcgi.server = ( "/web" => (( "bin-path" => "/home/eduardo/bin/echofcgi fastcgi", "max-procs" => 3, "check-local" => "disable", "fix-root-scriptname" => "enable", "port" => 1025 )), "/restservices" => (( "bin-path" => "/home/eduardo/bin/echofcgi2 fastcgi", "max-procs" => 3, "check-local" => "disable", "fix-root-scriptname" => "enable", "port" => 1027 )) ) } – EDUARDO J YANEZ PRADO Oct 30 '16 at 17:40
  • As I stated above, please edit your answer. – Paul Oct 30 '16 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.