mod_fastcgi

This is a wiki page. Be bold and improve it!

If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.

Troubleshooting

Debug

When experiencing difficulties, the first step is to increase the verbosity of the logs, by setting the LogLevel to 'debug' in your virtual host configuration file:

<VirtualHost *:80>
       LogLevel debug
</VirtualHost>

Then follow the logs:

tail -f /var/log/apache2/error.log

autoindex:error

Example log:

[Sat Jun 17 06:34:21.248253 2017] [autoindex:error] [pid 31089] AH01276: Cannot serve directory /var/www/http/: No matching DirectoryIndex (my_script.fcgi) found, and server-generated directory index forbidden by Options directive

Here my_script.fcgi was not found. Maybe you forgot to tell Apache where to find your script. Use the ScriptAliasMatch and AddHandler directives:

<VirtualHost *:80>
  ScriptAliasMatch ^/my_script.fcgi(.*)$ /var/www/cgi-bin/my_script.fcgi$1
  AddHandler fastcgi-script /var/www/cgi-bin/my_script.fcgi
</VirtualHost>

Request exceeded the limit of 10 internal redirects

Example log:

[Wed Jun 21 04:26:29.952753 2017] [core:error] [pid 28481]  AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Wed Jun 21 04:26:29.952762 2017] [core:debug] [pid 28481] core.c(3761):  AH00121: r->uri = /my_script.fcgi/my_script.fcgi/my_script.fcgi/my_script.fcgi/my_script.fcgi/home

The above may be found in conjunction to an .htaccess directive like this:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ my_script.fcgi/$1 [L,QSA]
</IfModule>

The solution is the same as in the previous problem. A ScriptAliasMatch directive for my_script.fcgi is probaly missing in the virtuahost configuration.

Alternatives

See:
http://linux.overshoot.tv/www-apache/mod_fcgid
http://linux.overshoot.tv/www-apache/mod_fastcgi_handler
www-apache/mod_scgi
virtual/httpd-fastcgi

app-admin/apache-tools-2.4.25 (/usr/sbin/fcgistarter)

mod_proxy_fcgi : https://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html