I often get this problem the first time I try to deploy a rails app
on dreamhost and I’m not sure what the cause is. Basically, I have
an app that’s running fine on my local machine. I’ve uploaded the
app, configured and migrated to the latest version of the db, and set
all of the necessary directories to 755. But when I run dispatch.rb
in ssh or access the site from a web browser it returns an Internal
500 error. I have no errors in my logs. Any ideas?
I often get this problem the first time I try to deploy a rails app
on dreamhost and I’m not sure what the cause is. Basically, I have
an app that’s running fine on my local machine. I’ve uploaded the
app, configured and migrated to the latest version of the db, and set
all of the necessary directories to 755. But when I run dispatch.rb
in ssh or access the site from a web browser it returns an Internal
500 error. I have no errors in my logs. Any ideas?
In panel.dreamhosters.com under Manage Domains, did you change Web
Directory to public or current/public (if using switchtower)?
Did you edit .htaccess to change .cgi to .fcgi? Make sure you don’t
stomp that with later uploads.
cd in public and do ./dispatch.fcgi it should run and give you and
Error 500 which is normal. If you get a compiler error you have
problems.
The dreamhost wiki says:
Troubleshooting: Error 500/Premature end of script headers
Make sure that the public directory and dispatch.cgi inside it are
not world-writable (chmod 755). If the problem remains, try running
dispatch.cgi from the command line.
You may also get the error: “Rails application failed to start
properly” which seems to be indicative of the same issue. You will
have to chmod all directories in your rails application directory as
well as public to 755.
Also, at least with the new rails 0.13.1, you shouldn’t have to
make any edits at all to the .htaccess file that is created if you
followed the rest of the directions on this page. You should at least
be able to get the basic rails app working.
The entire site directory has now been recursively set to 755. What
else can I do? I’m totally stumped here 9 hours to write a nice
app. 3 days to deploy it? I’m dying here guys help!!
Did you develop your code on Windows? If so, make sure your end of line
character is set correctly in the dispatch.fcgi file (open it in a Linux
editor, make a change and save it)
When you run the ‘rails’ command to generate your application
(including the dispatcher code) it uses the path of the instance of
ruby currently running to generate the #! line. So unless you are
running ruby from /usr/bin/ruby1.8 (which is what I believe Dreamhost
has as their default ruby 1.8 binary), you’ll always have this
problem.
I’m not sure what support DH has for using #!/usr/bin/env ruby, but if
that does work you should be able to use it cross-platform with
reasonable success.