1

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?

2 Answers2

2

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.

-1

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](http://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers). Please read [How do I write a good answer?](http://serverfault.com/help/how-to-answer) and consider revising your answer to include the steps required to resolve the issue. And don't forget to take the [site tour](http://serverfault.com/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