Okay, I wish I could write this now and then go back in time two days, read it, and save myself a lot of hassle. I spent a lot of time trying to debug a rails installation on a shared host and it could have been so much easier.
Get your Rails app working
Set file permissions. Do it like so: ./public needs to be set to 755
$ chmod 755 public
./public/dispatch.fcgi (or dispatch.cgi - but don’t use that!) also to 755
$ chmod 755 public/dispatch.fcgi
make sure ./public/.htaccess exists (my copy can be found at the bottom of this post) ./log and everything under it needs to be set to 775
$ chmod -R 775 log
do the same for the ./tmp directory (Rails writes session data here)
$ chmod -R 775 tmp
Make sure you’re running in ‘development’ mode. Code errors will be displayed to the screen in this mode - but ‘production’ will just barf out on you (it’s intended to work this way). Set RAILS_ENV=’development’ in config/environment.rb if you have no other way to do this.
$ nano config/environment.rb
If the above didn’t work, look at the bottom of any of your log files. Depending what environment you’re in you may need development.log or production.log. If it gives you a handy error like ‘could not find environment.rb’ or something like that it’ll really help you figure out the problem.
$ tail -n 100 log/development.log
Get into the ruby console. Try to run a command like you would in your app like User.find_all or something similar. This will show you errors that wouln’t come up elsewhere.
If you’re running an app that requires a specific version of Rails but didn’t include it along with the app you’ll need to ‘freeze’ Rails into your app. This is actually quite simple - if you put the whole Rails source code into ./vendor/rails then your application will use that code instead of the stuff on your server at /usr/lib/ruby/ The way to do this is to run any of the following:
rake freeze_gems # (get the latest stable version) rake freeze_edge # (get the latest stable version) svn co -r 997 http://dev.rubyonrails.org/svn/rails/trunk # (insert revision number you want instead of 997)
My working .htaccess file:
If these steps didn’t work for you leave a comment and I’ll try to help you out. I’m a GNU guy so I don’t know much about Rails on Windows, but I’d be happy to help you avaoid the hideous, hideous Rails errors.
Also, if you’re looking at random 500 errors while working on your Dreamhost account, you’ll want to use a modified dispatch.fcgi file.