# Problem with apache

**URL:** <https://www.ruby-forum.com/t/problem-with-apache/53815>\
**Category:** Rails\
**Created:** [February 14, 2006, 9:34pm UTC](https://www.ruby-forum.com/t/problem-with-apache/53815 "2006-02-14T21:34:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![g0nzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@g0nzo](https://www.ruby-forum.com/u/g0nzo)\
**Post date:** [February 14, 2006, 9:34pm UTC](https://www.ruby-forum.com/t/problem-with-apache/53815/1 "2006-02-14T21:34:56Z")

</div>

Hi!

I don’t know much about linux and apache configuration, so we’re using  
cpanel on our server to manage accounts etc.

I was trying to install ror (according to this page:  
[http://wiki.rubyonrails.org/rails/pages/HowtoInstallAndRunRubyOnRailsOnCpanel](http://wiki.rubyonrails.org/rails/pages/HowtoInstallAndRunRubyOnRailsOnCpanel))  
on our server, but it didn’t worked.

If i enter “[server.com/rails](http://server.com/rails)” i get “/testapp/index.html was not found”,  
if i enter “[server.com/rails/anything/](http://server.com/rails/anything/)” it says “/testapp/dispatch.fcgi  
was not found”, but if i try “[server.com/rails/404.html](http://server.com/rails/404.html)” or explicitly  
“[server.com/rails/index.html](http://server.com/rails/index.html)”, then it works, so the “public” directory  
is visible.

Here’s my dispatch.fcgi file:  
require File.dirname( **FILE** ) + “/…/config/enviroment”  
require ‘fcgi\_handler’  
require ‘rubygems’  
require\_gem ‘fcgi’  
RailsFCGIHandler.process!

And here’s .htaccess file:  
AddHandler fastcgi-script .fcgi  
AddHandler cgi-script .cgi  
Options +FollowSymLinks +ExecCGI  
RewriteEngine On  
RewriteBase /testapp  
RewriteRule ^$ index.html [QSA]  
RewriteRule ^([^.]+)$ $1.html [QSA]  
RewriteCond %{REQUEST\_FILENAME} !-f  
RewriteRule ^(.\*)$ dispatch.fcgi?$1 [QSA,L]  
ErrorDocument 500 “

## Application error
”

in httpd.conf i had already these lines:  
LoadModule fastcgi\_module libexec/mod\_fastcgi.so  
AddModule mod\_fastcgi.c

and just added these at the end of the file (if i added these right  
after “LoadModule” line apache didn’t restart):  
  
FastCgiIpcDir /tmp/fcgi\_ipc/  
AddHandler fastcgi-script .fcgi

I’m not really sure if the problem is in those files or httpd.conf or  
somewhere else.

---

<div class="post-metadata">

**Author:** ![g0nzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@g0nzo](https://www.ruby-forum.com/u/g0nzo)\
**Post date:** [February 15, 2006, 8:50am UTC](https://www.ruby-forum.com/t/problem-with-apache/53815/2 "2006-02-15T08:50:52Z")

</div>

Anyone? 🙂

If you don’t know what can cause this problem maybe you know some good  
apache forum where i could ask this question?

---

<div class="post-metadata">

**Author:** ![g0nzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@g0nzo](https://www.ruby-forum.com/u/g0nzo)\
**Post date:** [February 15, 2006, 10:37am UTC](https://www.ruby-forum.com/t/problem-with-apache/53815/3 "2006-02-15T10:37:49Z")

</div>

g0nz0,

Apache doesn’t like to dynamically start fcgi applications. I’ve got 3  
different rails apps running under my apache server with fastcgi.

I use the following in the server config:

FastCGIExternalServer \<FULLPATH-TO-DISPATCH.FCGI\> -appConnTimeout 30  
-idle-timeout 90 -host 127.0.0.1:9195

And I start the application with this:

cgi-fcgi -bind -connect 127.0.0.1:9195 \<FULLPATH-TO-DISPATCH.FCGI\> 1

Shawn M.

---

<div class="post-metadata">

**Author:** ![g0nzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@g0nzo](https://www.ruby-forum.com/u/g0nzo)\
**Post date:** [February 15, 2006, 1:53pm UTC](https://www.ruby-forum.com/t/problem-with-apache/53815/4 "2006-02-15T13:53:08Z")

</div>

Thanks!

I’ve changed .htaccess back to “RewriteRule ^(.\*)$ dispatch.cgi  
[QSA,L]”, so it should use cgi not fcgi. And the results are exactly the  
same (however it complaines about dispatch.cgi now). So it’s rather not  
fcgi that causes this problem.

---

<div class="post-metadata">

**Author:** ![g0nzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@g0nzo](https://www.ruby-forum.com/u/g0nzo)\
**Post date:** [February 15, 2006, 5:12pm UTC](https://www.ruby-forum.com/t/problem-with-apache/53815/5 "2006-02-15T17:12:05Z")

</div>

g0nzo wrote:

> Thanks!
> 
> I’ve changed .htaccess back to “RewriteRule ^(.\*)$ dispatch.cgi  
> [QSA,L]”, so it should use cgi not fcgi. And the results are exactly the  
> same (however it complaines about dispatch.cgi now). So it’s rather not  
> fcgi that causes this problem.

I’d suggest that if the app works with “script/server” using Webrick,  
and doesn’t with the apache deploy, I’d blame .htaccess or httpd.conf.

To be honest, blaming mod\_rewrite first is usually my preferred option  
🙂

Have you tried just running script/server in your rails directory and  
tesing it against port 3000 ?

A.

---

<div class="post-metadata">

**Author:** ![g0nzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@g0nzo](https://www.ruby-forum.com/u/g0nzo)\
**Post date:** [February 16, 2006, 10:11am UTC](https://www.ruby-forum.com/t/problem-with-apache/53815/6 "2006-02-16T10:11:17Z")

</div>

Just tried running webrick server and it works.  
So like you said it would be probably .htaccess or httpd.conf.  
But i’m really linux/apache newbie, so if you could tell me what are the  
most probable errors or how to check if necessary stuff is correctly  
installed (i followed the tutorial mentioned in the first post to  
install and configure everything) i’d be very grateful.
