FastCGI for nginx

Nginx® web server supports the FastCGI protocol. It has a FastCGI module.

For more information on configuring nginx, go to the nginx documentation.

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

Before the server {...} paragraph, add:
...
upstream fcgi_backend {
  server localhost:6394;
  keepalive 32;
}
...
This excerpt is the most common configuration, where the GAS (fastcgidispatch) is running on the same server as the nginx web server:
  • localhost is where fastcgidispatch is running.
  • 6394 is the default port for fastcgidispatch running as standalone.
If your GAS is on an external server, you must specify the IP address and port of this GAS in the upstream fcgi_backend server directive instead. If this configuration fails, configure the server_name entry (localhost or DNS name of the nginx server) in the server {...} paragraph.
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 $document_root$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.