Installing a RoR app on a webhost
Just figure I'd share a few steps which are useful in getting a RoR application up and running on a web hosting provider. Obviously the steps will vary depending on your specific provider, but most should be the same assuming your given access to a home directory on the web server under which public_html resides.
- Install your rails app in a location _not_ under ~/public_html. For example ~/rails/appname would be a good place
- Run through your application specific install instructions, configuring db if necessary
- Link the 'public' directory under the rails root, to the public_html directory, eg
ln -s ~/rails/appname/public ~/public_html/appname
- Edit .htaccess in the public directory, commenting out the following line and replacing it with:
(at least I had to do this w/ my provider, I'm not sure how many this applies to)
# AddHandler fastcgi-script .fcgi
AddHandler fcgid-script .fcgi
- Add your gem path to ~/rails/appname/config/environment.rb like so:
Obviously your local and system wide gem paths will vary depending on your system. Use the 'gem environment' command to determine what they are.
- Finally you may also need to add the following to your ~/rails/appname/config/environment.rb:
or if this doesn't work, add:
config.action_controller.related_url_root = '/appname'
This tells rails that our application is located under the '/appname' subdirectory of our webroot, eg in our case ~/public_html.
ActionController::AbstractRequest.related_url_root = '/appname'
Though the process is pretty straightforward, since your not in control of the entire web server you may run into some tricky points as evident through the many related posts out there. Also your web application may have bugs of its own, further complicating the situation. Just stick to it and you should get it eventually.