First you need to know that officially GoDaddy only supports rails v 1.1.6. That's the version you will find if you execute the command
gem list rails
Currently the latest rails version is v 2.2.3. So, it's no wonder if you are creating a new project you won't think of using such an old version. So if you are stuck with a GoDaddy host, let me tell you that you aren't forced to use this version.
Other rails versions are located in the following path
/usr/local/lib/ruby/gems-dev/1.8/gems
At the date of writing this article version '2.0.5′ is deployed. I will use it to guide you to the setup steps.
1. Navigate to the CGI Admin located in the following
2. Select the Ruby Tab
3. In the "Create Rails App Directory" write the name of you application and click "create"
4. After creating your ruby folder, you will need to create a symbolic link that points to your rails app. folder. In the "Create Rails Symbolic Link" section, click on "Show Rails Application"
Select the app. directory and write the name of the symbolic link then press the "create" button.
5. Now you have create the folder, connect to your host using your favorite ftp client using the following settings
Server: ftp.yourdomain.com
User: your_username
Password: your_password
Port: 21
6. upload your rails app to the rails app. folder you created.
7. Update shebang line with Godaddy's path
Edit public\dispatch.cgi, public\dispatch.fcgi, public\dispatch.rb and Replace first line with
#!/usr/local/bin/ruby
8. Set the rails environment to production. Edit "config\environment.rb" and uncomment the following line
ENV['RAILS_ENV'] ||= 'production'
9. Set the 'GEM_HOME' to the dev Gems repos. to be able to use the latest gem version
Edit "config\environment.rb" and set the 'GEM_HOME' if not set to the following
ENV['GEM_HOME'] = '/usr/local/lib/ruby/gems-dev/1.8′
10. Edit the "public\.htaccess"
RewriteBase /the_symbolink_link_you_created
11. Update Permissions
You need to update the 'dispatch.cgi' and 'dispatch.fcgi' permissions, you can use SSH to do so, following is the steps.
ssh your_username@your_domain.com
your_password
cd htm\symbolic_link\public
chmod 755 dispatch.cgi
chmod 755 dispatch.fcgi
12. Now you should be able to access your rails app using the following URL
13. If you want to access the rails app directly when entering your domain URL, apply the following
Create a '.htaccess' in the root folder if not created
Edit the file and add the following line
RewriteEngine On
RewriteRule ^(.*)$ http://www.your_domain.com/sybmolic_link/$1 [R,L]
One Response to "How to host a Ruby application on GoDaddy"