Nginx – How to spawn-fcgi multiple fcgi processes

nginxspawn-fcgi

We have nginx installed and would like to spawn-fcgi multiple ".fcgi" files. The programs were written in C. How do we spawn all the files at one go ?

Edit

This is the scenario :

I have 3 different programs to serve. Lets say, I've search results from google, yahoo, bing. I want to show 3 columns which host results of above providers. I have 3 fcgi scripts, one for each provider.
How do you suggest I put all 3 into action ?

Best Answer

The fact that you're calling them "FCGI scripts" implies that you intend for your executables to be short-lived; this isn't really what FCGI was designed for. One of the features of FCGI is that processes are designed to be long-running (compared to old-school CGI scripts which re-initialized each time they were called).

Instead of switching between three different executables connected via FCGI, could you use a single long-running executable via FCGI that has an internal function pointer to define the desired functionality on a call-by-call basis?

The other half of your question relates to how to manage the running FCGI application to allow it to be accessed via nginx. You'll need a process management application like supervisor to launch and monitor your FCGI application.