Skip to content
bsag edited this page Jul 16, 2011 · 1 revision

Hostgator

Installation with mongrels (From aexl on the forums)

I finally got the trick, here is how it worked for me:

  • ignore the forum post about rails installation
  • ignore support staff that only points you to the forum post
  • use cpanel/rails to create rails app and webforwarder
  • delete rails app template and unpack tracks here
  • do some environment magic (*)
  • in cpanel/rails start webapp
  • what environment magick is needed?

in config/environment.rb add this line:

Rails::Initializer.run do |config|

  1. some hosting might need this (hostgator does)
    config.load_paths += %W( #{RAILS_ROOT}/vendor/plugins )

Installation with fastcgi (From kikontrack on the forums)

Hostgator recently added support to run rails app with fcgi

  • First check in the rubygems menu of the cpanel that you have the proper rails version and that the fcgi gem is installed
  • Unzip Tracks in /home/YOUR_USER/rails/ (so will be located in /home/YOUR_USER/rails/tracks/)
  • In my cpanel or shell, create mysql database and mysql user for Tracks
  • In /home/YOUR_USER/rails/tracks/config/database.yml, setup the proper adapter for mysql
  • Then in /home/YOUR_USER/rails/tracks/ I run rake db:migrate RAILS_ENV=production
  • I created the entry in public_html with a symlink ln -s /home/YOUR_USER/rails/tracks/public/ /home/YOUR_USER/public_html/tracks
  • I added a .htaccess file in /home/YOUR_USER/rails/tracks/public/ which contains the following

AddHandler fcgid-script .fcgi Options +FollowSymLinks +ExecCGI RewriteEngine On RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"

  • In /home/YOUR_USER/rails/tracks/config/environment.rb uncomment ENV[‘RAILS_ENV’] = ‘production’
  • Add the line ENV[‘RAILS_RELATIVE_URL_ROOT’]=“/tracks”
  • And add the line config.load_paths += %W( #{RAILS_ROOT}/vendor/plugins )
  • Adjust the subdir in site.yml to “/tracks”

Then open your browser to http://YOUR_DOMAIN/tracks and you should be good to go ;)

Installation with fastcgi and SSL (From kikontrack on the forums)

Reproduce above steps then

  • Create a file dispatch-tracks.fcgi /home/YOUR_USER/public_html/
    #!/usr/bin/env ruby Dir.chdir("/home/YOUR_USER/rails/tracks/public") require File.dirname(__FILE__) + "/../config/environment" require 'fcgi_handler' RailsFCGIHandler.process!
  • Change the .htaccess rewrite to: RewriteRule ^(.*)$ /~YOUR_USER/dispatch-tracks.fcgi [QSA,L]
  • Change the line ENV[‘RAILS_RELATIVE_URL_ROOT’]=“/~YOUR_USER//tracks”
  • Adjust the subdir in site.yml to “/~YOUR_USER/tracks”

Then open your browser to https://YOUR_DOMAIN/~YOUR_USER/tracks and you should be good to go ;)
You will get a SSL mismatch error has the SSL is sign for hostgator domain name, but you can import the certificate in your browser to not get the warning every time

Clone this wiki locally