Problem with apache


#1

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)
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 “

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.


#2

Anyone? :slight_smile:

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


#3

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.


#4

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.


#5

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
:slight_smile:

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

A.


#6

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.