Forum: Ruby on Rails problem with apache

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F639e0cdf2fa098b535d6ec766b2aee1?d=identicon&s=25 Szymon Nowak (g0nzo)
on 2006-02-14 21:34
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/HowtoInsta...)
on our server, but it didn't worked.

If i enter "server.com/rails" i get "/testapp/index.html was not found",
if i enter "server.com/rails/anything/" it says "/testapp/dispatch.fcgi
was not found", but if i try "server.com/rails/404.html" or explicitly
"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 "<h2>Application error</h2>"

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):
<IfModule mod_fastcgi.c>
    FastCgiIpcDir /tmp/fcgi_ipc/
    AddHandler fastcgi-script .fcgi
</IfModule>

I'm not really sure if the problem is in those files or httpd.conf or
somewhere else.
F639e0cdf2fa098b535d6ec766b2aee1?d=identicon&s=25 Szymon Nowak (g0nzo)
on 2006-02-15 08:50
Anyone? :)

If you don't know what can cause this problem maybe you know some good
apache forum where i could ask this question?
75981abd53f93b300794eed532639e7a?d=identicon&s=25 Shawn Mathews (Guest)
on 2006-02-15 10:37
(Received via mailing list)
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 Mathews
F639e0cdf2fa098b535d6ec766b2aee1?d=identicon&s=25 Szymon Nowak (g0nzo)
on 2006-02-15 13:53
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.
4daf0b71d5d9a3882e583c0e72eaf5dc?d=identicon&s=25 Alan Francis (Guest)
on 2006-02-15 17:12
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.
F639e0cdf2fa098b535d6ec766b2aee1?d=identicon&s=25 Szymon Nowak (g0nzo)
on 2006-02-16 10:11
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.
This topic is locked and can not be replied to.