Apache (both 1.3 & 2) not calling dispatch.fcgi on Debian

We’re trying to run Ruby on Rails on Debian with Apache and FastCGI, but
can’t get it to work. As far as we can tell, it seems to go wrong in the
final stages; Apache appears not to be doing anything with
dispatch.fcgi, even though FastCGI looks to be set up correctly. We’ve
followed several "how to"s, but we don’t get any other results.

What we’ve done:

  • In general, we’ve followed instructions as listed on the Rails Wiki,
    the Agile Web D. with Rails book, and another website with
    basically the same instructions (don’t have URL handy now, sorry). Other
    resources on the web don’t appear to have different information.
  • We have a test application with a simple fake controller made to check
    if everything works. This resides in /home/user/testapp, but we have a
    symlink set up in /var/www/test linking to the public/ dir under the
    application.
  • We have Apache 2 running (although we later tried with 1.3, giving the
    same problem).
  • We installed the latest version of mod_fastcgi (after installing the
    Developers Kit).
  • We installed the fcgi gem for Ruby.
  • We have the following server configuration in httpd.conf (essentially
    straight from the Agile book):

    FastCgiIpcDir /tmp/fcgi_ipc
    FastCgiServer /var/www/dispatch.fcgi
    -initial-env RAILS_ENV=production
    -processes 3 -idle-timeout 60
  • With this set up, we see that Apache starts three FastCGI threads,
    showing up in both the apache logs and the fastcgi.crash.log in the
    Rails application.
  • To be sure: we made the public and log directories available for
    Apache, as well as the /tmp/fcgi_ipc directory mentioned in the
    configuration. (In fact, Apache will complain if this is not set up
    correctly).
  • The line in .htaccess has been changed to use dispatch.fcgi rather
    than dispatch.cgi.
  • We tried this on two different machines, but with the same effect.

What goes wrong:
When we try to approach our application on localhost, we get the the
static welcoming page from our application, but that is as far as we
get. As soon as we try to ask for our controller, we get a 404, and the
Apache error log tells us that it cannot find the file at
/var/www/test/fake (fake being the name of our controller, which has a
index.rhtml page in the views dir). That’s all the information we get,
nothing is listed in any other logs. Of course, this request should have
been handled by dispatch.fcgi, but it seems to us this was never called.
We think the problem lies there, as FastCGI itself appears to be
installed correctly (with Apache starting up the threads). However, we
haven’t been able to find anything wrong.

Any suggestions or tips as to what the problem might be would be very
much appreciated.

thanks,

Jeroen Heijmans

On Wed, 2006-03-15 at 08:31 +0100, Jeroen Heijmans wrote:

resources on the web don’t appear to have different information.
straight from the Agile book):
Apache, as well as the /tmp/fcgi_ipc directory mentioned in the
Apache error log tells us that it cannot find the file at


It’s late, I’m tired and may not be of much help but I was clobbered by
this and it turned out that the very last ‘ReWrite’ line of
public/.htaccess had to be…

RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

or it didn’t work (I had it further up the file).

make sure that you delete all /tmp/session files after your restart
apache and before you try to use a browswer.

Craig

Does your Apache installation have mod_rewrite installed?

regards,

Joseph

Am Mittwoch, den 15.03.2006, 00:37 -0700 schrieb Craig W.:

basically the same instructions (don’t have URL handy now, sorry). Other

  • We have the following server configuration in httpd.conf (essentially
  • To be sure: we made the public and log directories available for
    get. As soon as we try to ask for our controller, we get a 404, and the
    much appreciated.
    make sure that you delete all /tmp/session files after your restart
    apache and before you try to use a browswer.

Try to enable the rewrite log and examine what is happening.

http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritelog


Norman T.

http://blog.inlet-media.de

Jeroen Heijmans wrote:

We’re trying to run Ruby on Rails on Debian with Apache and FastCGI, but
can’t get it to work.

What we’ve done:

… This resides in /home/user/testapp, but we have a
symlink set up in /var/www/test linking to the public/ dir under the
application.

Why did you symlink to the subdirectory named ‘public’? Please provide
the URL advising you to do this.

Why did you specify /var/www/dispatch.fcgi in your Apache config if your
rails application is in /home/user/testapp? Please provide the URL
advising you to do this.

Given the above setup, I don’t know how rails would figure out that it
should look in /home/user/testapp/… directories for various components
and scripts.

Please provide the URLs so we can ask the authors to stop confusing
people.

Thanks for the replies, everybody. I managed to get it running (with
Apache 2). It appears that I just need to enable the modules (fcgi,
rewrite) and the site (testapp) using the utils a2enmod and a2ensite.
After that, everything worked.