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

**URL:** <https://www.ruby-forum.com/t/apache-both-1-3-2-not-calling-dispatch-fcgi-on-debian/54921>\
**Category:** Rails\
**Created:** [March 15, 2006, 8:31am UTC](https://www.ruby-forum.com/t/apache-both-1-3-2-not-calling-dispatch-fcgi-on-debian/54921 "2006-03-15T08:31:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeroen\_Heijmans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@Jeroen\_Heijmans](https://www.ruby-forum.com/u/Jeroen_Heijmans)\
**Post date:** [March 15, 2006, 8:31am UTC](https://www.ruby-forum.com/t/apache-both-1-3-2-not-calling-dispatch-fcgi-on-debian/54921/1 "2006-03-15T08:31:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jeroen\_Heijmans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@Jeroen\_Heijmans](https://www.ruby-forum.com/u/Jeroen_Heijmans)\
**Post date:** [March 15, 2006, 8:37am UTC](https://www.ruby-forum.com/t/apache-both-1-3-2-not-calling-dispatch-fcgi-on-debian/54921/2 "2006-03-15T08:37:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jeroen\_Heijmans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@Jeroen\_Heijmans](https://www.ruby-forum.com/u/Jeroen_Heijmans)\
**Post date:** [March 15, 2006, 2:06pm UTC](https://www.ruby-forum.com/t/apache-both-1-3-2-not-calling-dispatch-fcgi-on-debian/54921/3 "2006-03-15T14:06:57Z")

</div>

Does your Apache installation have mod\_rewrite installed?

regards,

Joseph

---

<div class="post-metadata">

**Author:** ![Jeroen\_Heijmans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@Jeroen\_Heijmans](https://www.ruby-forum.com/u/Jeroen_Heijmans)\
**Post date:** [March 15, 2006, 2:44pm UTC](https://www.ruby-forum.com/t/apache-both-1-3-2-not-calling-dispatch-fcgi-on-debian/54921/4 "2006-03-15T14:44:52Z")

</div>

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](http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritelog)

–  
Norman T.

[http://blog.inlet-media.de](http://blog.inlet-media.de)

---

<div class="post-metadata">

**Author:** ![Jeroen\_Heijmans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@Jeroen\_Heijmans](https://www.ruby-forum.com/u/Jeroen_Heijmans)\
**Post date:** [March 15, 2006, 5:07pm UTC](https://www.ruby-forum.com/t/apache-both-1-3-2-not-calling-dispatch-fcgi-on-debian/54921/5 "2006-03-15T17:07:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jeroen\_Heijmans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e56c9b/32.png) [@Jeroen\_Heijmans](https://www.ruby-forum.com/u/Jeroen_Heijmans)\
**Post date:** [March 16, 2006, 2:00pm UTC](https://www.ruby-forum.com/t/apache-both-1-3-2-not-calling-dispatch-fcgi-on-debian/54921/6 "2006-03-16T14:00:26Z")

</div>

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.
