Fastcgi for nginx

NGINX® has a fastcgi module. The "nginx" fastcgi module is not the same as mod_fastcgi for Apache.

Note: Assume the Genero Application Server is installed in the following directory (FGLASDIR): /opt/gas. Make the appropriate substitution for the FGLASDIR when applying these examples to your own configuration.

Edit the Web site configuration file (for example, located in /etc/nginx/sites-enabled/default).

Before the server {...} paragraph, add:
...
upstream fcgi_backend {
  server 127.0.0.1:6394;
  keepalive 32;
}
...
In this excerpt:
  • 127.0.0.1 is the ip where the fastcgidispatch is running.
  • 6394 is the port where fastcgidispatch listens to.
Inside the server {...} paragraph, configure the fastcgi module to reuse socket connections for requests:
...
location /gas/ {
  fastcgi_keep_conn on;
  fastcgi_pass fcgi_backend;
  include fastcgi_params;
  }
...
In the fastcgi_params file (for example, located in /etc/nginx/), add:
...
  fastcgi_split_path_info (/gas)(/?.+)$;
  fastcgi_param SCRIPT_FILENAME /path/to/php$fastcgi_script_name;
  fastcgi_param PATH_INFO $fastcgi_path_info;
  fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
...
In this excerpt:
  • /gas is the gas connector alias.
In the fastcgi_params file, find the line that reads:
fastcgi_param SERVER_NAME $server_name;
and replace with:
fastcgi_param SERVER_NAME $host;

The fastcgidispatch needs to be started in standalone mode: fastcgidispatch -s.

If this dispatcher fails, it must be restarted manually.