Portal Home > Knowledgebase > General > Ruby Rails / FastCGI / Ruby Gems


Ruby Rails / FastCGI / Ruby Gems




Ruby Rails / FastCGI / Ruby Gems

To use an existing application
Make sure that your app lives in /home/USER/testapp
Change the line in your Rails application’s public/dispatch.fcgi

Change:

require 'fcgi'
To:

require 'rubygems'
require_gem 'fcgi'
Make sure Apache can find dispatch.fcgi
Now edit your app's public/.htaccess and change/add the following lines to make sure that the Rails app is using FastCGI and that it knows that the app is living in a subdirectory.

Change:

RewriteRule ^(.*)$ dispatch.cgi?$1 [QSA,L]
To:

RewriteBase /testapp
RewriteRule ^(.*)$ dispatch.fcgi?$1 [QSA,L]
Make sure that dispatch.fcgi is executable:

chmod 755 public/dispatch.fcgi
All should be installed! :)

For a new account, you can test RoR out by creating a test cPanel account and doing:

cd /home/USER
rails /home/USER/testapp
cd /home/USER/testapp/
ruby script/generate controller test
cd /home/USER/public_html
ln -s ../testapp/public rails
Replace USER with an appropriate username ;)

Then navigate to http://www.yourtestdomain.com/rails/ and you should see a Congratulations page!

Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
My Website is Down! (Views: 1559)
.htaccess tutorials (Views: 2946)
Webmin (Views: 1281)
How to: Tar Files (Views: 1324)