I got a brand new Fedora Core 4 box and was all excited to get Rails
running on it. That was about two days ago. I did all the ‘yum install
ruby, etc. etc. etc.’, then ‘gem install rails, etc. etc. etc’. I’ve
tried running Rails with httpd (fastcgi and cgi), lighttpd (scgi,
fastcgi, cgi), mongrel, webrick, and even ‘ruby
public/dispatch.cgi|fcgi|rb’ and NONE of them work; they all display
‘500: internal server error’ or ‘Rails application failed to start
properly’.
‘ruby -w public/dispatch.fcgi|cgi|rb’ displays a ton of warnings (things
like ‘ambiguous first argument’, ‘method redefined’, ‘instance variable
not initialized’, etc., but no errors that appear to be show-stoppers).
And that’s about it - there is NOTHING helpful in any of httpd’s,
lighty’s, Rails’, etc. logs that hints at what the problem is (there
were some fastcgi entries in httpd’s error log - ‘fastcgi incomplete
headers’ and ‘unable to access log file’ (I’ve ensured they’re
writable).
I can access the Rails models through script/console, so I’m pretty sure
my database.yml is correct.
For trying to get this to work with httpd, I followed these
instructions: http://wiki.rubyonrails.com/rails/pages/FastCGI
But getting up and running with mongrel and webrick should be dead
simple. I’ve read that SELinux - which I know next to nothing about -
might be causing problems, but I don’t see any related messages. And it
appears to be set to ‘permissive’ and I ‘setenforce 0’ just for good
measure.
Can anybody take a guess at what the problem is, before I feel totally
0wn3d?
First off, take a deep breath or you will be 0wn3d. I would highly
recommend trying to get one configuration to work and not jumping
between
them. I did that for a while and it just makes a mess. I know the
following to be true:
Rails works great with Lighttpd and thousands of people have gotten it
to
work. I would focus on getting this configuration to work.
Most times if you are experiencing the issues you describe it is a
database
configuration problem (which you seemed to have ruled out) or a path
issue
in one of your configuration files. I always recommend going to the
directory you want things to point to and running a pwd to confirm the
path.
If you have light installed (which it sounds like you do), you should be
able to get ./script/server to fire up light instead of webrick (Make
sure
light is in your $PATH!). This will create a working lighttpd.conf file
for
your app, though you might need to adjust some paths, to get you
started.
I know this isn’t much, but stick in there and you’ll get it working.
~ Ben
PS. At least your not trying to set it up on Windows That is where
my
nightmare started.
If you have light installed (which it sounds like you do), you should be
able to get ./script/server to fire up light instead of webrick (Make
sure
light is in your $PATH!). This will create a working lighttpd.conf file
for
your app, though you might need to adjust some paths, to get you
started.
I didn’t know that could be done - learned something new! I always
assumed script/server = webrick.
PS. At least your not trying to set it up on Windows That is where
my nightmare started.
Heh, I tried to fix it a la Windows and reboot, and now the server’s not
coming back online. Got some time while the NOC figures it out.
I’m at a loss why it doesn’t work. The same Rails apps are working fine
on my old server. I transferred them to the new server via ‘svn co’.
Ruby was installed in /usr/local/bin but I created a symbolic link to it
in /usr/bin, and it seems to work fine. I did ‘strace ruby -w
public/dispatch.rb’ and it looks like it might be getting hung up trying
to find some ‘items_api.rb’ file (which I never had in my app). I dunno.
Sorry if this seems too obvious, but you’ve said ruby script/console
works but haven’t said how you tried to run WEBrick.
What happens when you run script/server from the commandline?
If that’s working, you probably have a permissions or some other sort of
fundamental configuration problem. If script/console works but
script/server doesn’t… um…
Joe wrote:
I got a brand new Fedora Core 4 box and was all excited to get Rails
running on it. That was about two days ago. I did all the ‘yum install
ruby, etc. etc. etc.’, then ‘gem install rails, etc. etc. etc’. I’ve
tried running Rails with httpd (fastcgi and cgi), lighttpd (scgi,
fastcgi, cgi), mongrel, webrick, and even ‘ruby
public/dispatch.cgi|fcgi|rb’ and NONE of them work; they all display
‘500: internal server error’ or ‘Rails application failed to start
properly’.
‘ruby -w public/dispatch.fcgi|cgi|rb’ displays a ton of warnings (things
like ‘ambiguous first argument’, ‘method redefined’, ‘instance variable
not initialized’, etc., but no errors that appear to be show-stoppers).
And that’s about it - there is NOTHING helpful in any of httpd’s,
lighty’s, Rails’, etc. logs that hints at what the problem is (there
were some fastcgi entries in httpd’s error log - ‘fastcgi incomplete
headers’ and ‘unable to access log file’ (I’ve ensured they’re
writable).
I can access the Rails models through script/console, so I’m pretty sure
my database.yml is correct.
For trying to get this to work with httpd, I followed these
instructions: Peak Obsession
But getting up and running with mongrel and webrick should be dead
simple. I’ve read that SELinux - which I know next to nothing about -
might be causing problems, but I don’t see any related messages. And it
appears to be set to ‘permissive’ and I ‘setenforce 0’ just for good
measure.
Can anybody take a guess at what the problem is, before I feel totally
0wn3d?
Sorry if this seems too obvious, but you’ve said ruby script/console
works but haven’t said how you tried to run WEBrick.
What happens when you run script/server from the commandline?
If that’s working, you probably have a permissions or some other sort of
fundamental configuration problem. If script/console works but
script/server doesn’t… um…
Yep, ‘./script/server’ (and mongrel) appeared to start fine. Accessing
it via mydomain:3000 displays a ‘500 internal server’ error. WEBrick
displays a ‘500 0’ line in its log too.
Oh yeah, one other thing, I can access static content fine - images,
text files, etc. - via all servers (lighty, httpd, webrick, mongrel),
just nothing Rails.
Yep, ‘./script/server’ (and mongrel) appeared to start fine. Accessing
it via mydomain:3000 displays a ‘500 internal server’ error. WEBrick
displays a ‘500 0’ line in its log too.
Oh yeah, one other thing, I can access static content fine - images,
text files, etc. - via all servers (lighty, httpd, webrick, mongrel),
just nothing Rails.
Stupid question, but… Is your database configuration set-up properly?
Yep, ‘./script/server’ (and mongrel) appeared to start fine. Accessing
it via mydomain:3000 displays a ‘500 internal server’ error. WEBrick
displays a ‘500 0’ line in its log too.
Oh yeah, one other thing, I can access static content fine - images,
text files, etc. - via all servers (lighty, httpd, webrick, mongrel),
just nothing Rails.
Stupid question, but… Is your database configuration set-up properly?
AFAICT. I can access it via psql, script/console, and phppgadmin. I
thought it might be a problem with ‘accept tcp connections’, which
Postgresql used to have turned off and from which I’ve been bitten in
the past. But I guess that option has been merged with the
cantrememberwhatitscalled_connections = ‘localhost’ option. Anyhow,
since I presume since I can access models via script/console,
database.yml must be correct. Unless Rails connects differently via web
servers?
One thing that has bitten me: when I forget to grab a gem I need (or
some
other included software).
If your app uses a special gem or plugin in a view or controller and it
isn’t present, I can see Rails just dying (and in my experience there is
no
meaningful error message, just death).
And it worked! But ‘ruby public/dispatch.rb’ gives a ‘500 internal
server error’.
One of my existing Rails apps (also gotten via ‘svn co’) is really
simple and doesn’t use any additional gems, but that doesn’t work
either. I wonder if it’s something infuriatingly stupid like DOS/Unix
format config files or something.
<% Item.find_all.each |item| %>
<%= item.name %>
<% end %>
and that causes ‘wget http://localhost:3001/wtf/iswrong’ to return a 500
error. So it’s gotta be a database access issue. But I don’t know why
models work in script/console.
I got the simple site working - turns out it was a missing template that
hadn’t been added to svn on the old server. Haven’t figured out why the
more complex sites aren’t working yet.
Joe
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.