Created Hostgator (textile)

bsag 2011-07-16 08:34:28 -07:00
parent d0be7235ab
commit 5a841fbe63

79
Hostgator.textile Normal file

@ -0,0 +1,79 @@
h1. Hostgator
<b>Installation with mongrels</b> (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:
<code>
Rails::Initializer.run do |config|
# some hosting might need this (hostgator does)
config.load_paths += %W( #{RAILS_ROOT}/vendor/plugins )
</code>
<b>Installation with fastcgi</b> (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
<code>
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"
</code>
* 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 ;)
<b>Installation with fastcgi and SSL</b> (From kikontrack on the forums)
Reproduce above steps then
* Create a file dispatch-tracks.fcgi /home/YOUR_USER/public_html/
<code>
#!/usr/bin/env ruby
Dir.chdir("/home/YOUR_USER/rails/tracks/public")
require File.dirname(__FILE__) + "/../config/environment"
require 'fcgi_handler'
RailsFCGIHandler.process!
</code>
* 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