Search code examples
cnginxfastcgi

C API for spawning a FCGI server?


I made a FCGI program in C using fastcgi.com's API. I've called FCGI_Accept like the docs say. When I run the resulting executable it just runs through like a CGI program, and exits.

I need the API for web servers where it listens on a UNIX domain socket. I am using nginx which does not spawn FCGI programs on its own and fastcgi.com's API library. I do not want to use other servers or libraries to spawn my FCGI program.


Solution

  • I'm having the same problem trying to launch a FastCGI application written using the fcgi_stdio library for use with nginx. If I launch the application normally it acts like normal CGI and exits immediately. I'm not sure what secret sauce is normally done to get the application to act like FastCGI instead of CGI by the http daemon (that nginx doesn't do), but spawn-fcgi does it. It's available in the EPEL repository for use with RHEL/CentOS/Amazon Linux/etc. I don't know if that helps your situation, but it was what I finally ended up using.