Apache: mod_fastcgi

Module mod_fastcgi is the Apache module for FastCGI support.

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.
Important: Apache 2.4 does not support mod_fastcgi. If you are using Apache 2.4, use mod_proxy_fcgi instead, see Apache 2.4: mod_proxy_fcgi.
Note: For more information on the Apache modules, refer to the Apache documentation.

mod_fastcgi installation

Install software package for your system or use these instructions.

mod_fastcgi configuration to manage GAS process

Add these lines to your Apache configuration file:
LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so

<IfModule mod_fastcgi.c>
  FastCgiServer /opt/gas/bin/wrapper.fcgi -idle-timeout 300
    -initial-env FGLASDIR=/opt/gas
  Alias /gas /opt/gas/bin/wrapper.fcgi
</IfModule>

# set permissions for /gas alias
<Location /gas>
  Order Deny,Allow
  Deny from all
  Allow from mycompany.com
</Location>

In the fastcgi configuration example:

  • wrapper.fcgi is a script delivered with GAS installation that simplifies FastCGI configuration. You can amend this script to add options for fastcgidispatch, like -f to specify a custom configuration file.
  • /gas directory is just a virtual directory, no need to create one.
  • /gas alias permission is set to deny all access to GAS except for clients from mycompany.com. You can modify the alias configuration to your needs. For more details on Apache directives, see Apache documentation.
  • "-idle-timeout" must be greater than REQUEST_RESULT timeout in GAS configuration. [By default: <REQUEST_RESULT> : 240 seconds, mod_fastcgi"-idle-timeout" : 300 seconds]

Using mod_deflate for compression with mod_fastcgi

Normally on Apache web server, compression is enabled through the mod_deflate module. You should be aware that there is a known bug (see http://osdir.com/ml/ubuntu-bugs/2009-05/msg47891.html ) resulting in incorrect content-length header being returned when pages are loaded as the content-length is not updated after compression. You may begin, therefore, to notice a slow down in your applications as:
  • The client (user agent) waits to receive content that doesn't exist while it is unaware that it already has the entire response.
  • The client (user agent) waits until eventually a timeout is reached.
Moreover as GAS does compression by default (see Compression in Genero Application Server), mod_deflate's functionality is really unnecessary. It is therefore recommended that you disable mod_deflate. For more information on disabling mod_deflate, please refer to the fastcgi documentation or contact your system administrator.