Apache: mod_fastcgi

Module mod_fastcgi is the Apache module for FastCGI support for versions of Apache prior to 2.4.

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 the software package for your system. For more information, see the FastCGI archive site.

mod_fastcgi configuration to manage GAS process

In your Apache configuration file (for example, httpd.conf):
  • Enable the load module directive for mod_fastcgi by removing the hash symbol (#) from the start of the line. Be aware that your configuration may be different to that shown in the example.
  • Add the lines to configure fastcgi server and set permissions for the GAS.
LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so

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

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

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 FastCgiServer directive, see mod_fastcgi Apache 2 module.
  • "-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.