cFosSpeed is now in new hands. Atlas Tech Solutions now owns, develops, and sells new versions of it
Also visit our cFos eMobility page for our electro mobility products, like cFos EVSE, cFos Charging Manager and cFos Wallbox Booster

How to use FastCGI with cFos Personal Net

FastCGI is an improvement over CGI: Running a normal CGI script has a lot of overhead. A new process must be created, the script interpreter must be started and the script has to be at least parsed.

FastCGI eliminates much of this overhead. A FastCGI script or app is only started once and then communicates with the web server by means of special FastCGI messages. HTTP script requests to this script and their responses use these messages. The process stays indefinitely in memory and the script must only be parsed once. This allows for script execution with far less overhead.

For cFos Personal Net, this also allows you to use Node.js for Javascript programs (and with it one of the fastest Javascript engines).

Here are the steps for installing FastCGI with Node.js for cFos Personal Net:

  1. Install and run cFos Personal Net
  2. Install Node.js
  3. Install the node module node-fastcgi by running "npm i node-fastcgi" (or "npm i -global node-fastcgi")
  4. Modify sample script fcgi_test.fcgi in the cFos Personal Net pub/fcgi directory
  5. Open http://localhost/pub/fcgi/fcgi_test.fcgi in our browser

cFos Personal Net supports the FastCGI role "Responder", i.e. the FastCGI app / script is called to process the HTTP request. It only supports the configuration where one FastCGI script per requested filename is started and requests are multiplexed over one connection. Since FastCGI scripts operate very similar to normal CGI scripts, they typically use STDIN / STDOUT for communication with the web server. Therefore this configuration makes the most sense.

To ease development of your own FastCGI scripts (e.g. with Node.js), script errors are redirected to the browser. Also: When developing the script you don't need to restart the web server when you change the script. Just kill the process of the script interpreter. cFos Personal Net will reload the (new version of) the script when needed in the next request.


References

FastCGI specification
https://github.com/fast-cgi/spec/blob/master/spec.md

FastCGI on Wikipedia
https://en.wikipedia.org/wiki/FastCGI

Node.js
https://nodejs.org/en/

Node.js module for FastCGI
https://www.npmjs.com/package/node-fastcgi


cFos Personal Net documentation