Lunarpages Internet Solutions Blog
  • Home
  • About Us
  • LunarForums
  • Free Web Tools
  • Free WP Themes
0

Rockin’ Your Ruby on Rails!

17 November, 2006 - Geeky, Jabber

Author: Danielle Wallace

Danielle Wallace works for Lunarpages Webhosting and runs RubyAsylum.com in her spare time. She normally lives in Coralville, Iowa, although she travels to Las Vegas from time to time for her job.

== – ==

Running Multiple Ruby on Rails Applications on One Domain

Ruby on Rails is the hot new framework for the Ruby language that supports Ajax, database migrations and other cool features. Using Rails, however, it might not appear straightforward how you can have multiple applications on one domain. This tutorial will cover how you can achieve this goal in only a few steps.

The main application

Let’s say you have setup a folder called rails1 where your main Rails application is housed. You’ve placed this folder outside your publically accessible folder level at /home/username/ (so the full path would be /home/username/rails1). Please note the example path could be different, but it would be whatever is your domain’s root level, which is one level above and outside your publically viewable folder. In my example, the folder where web applications are viewable would be the /home/username/public_html path.

Next, you want to have your Rails application public folder (/home/username/rails1/public) symlinked to your web folder

( /home/username/public_html), so you would issue the following set of commands in most Linux environments:

cd /home/username
mv public_html public_html.old
ln -s /home/username/rails1/public /home/username/public_html
chown username:nobody /home/username/rails1/public

The final chown would need to match the ownership your web folder (public_html in my example) normally would have. Please check the ownership by listing ( ls -l /home/username) and seeing what public_html shows for ownership and file permissions before you move the folder to public_html.old and you should then chown or chmod the /home/username/rails1/public folder to those same values.

The next application

Let’s say your next application is called rails2 and resides at the /home/username/rails2 path. You want to have it publically viewable as a folder on your domain, so you use the following commands to symlink it:

ln -s /home/username/rails2/public /home/username/public_html/rails2

In this example, please note that the rails2 folder should not already exist inside public_html for the symlink. Additionally, please note that you can call the folder inside public_html anything: It does not have to have the same name as the Rails application at /home/username/rails2 does.

After doing this symlink, you would need to make one change to your Rails application in order for it to work. Go to /home/username/rails2/public and open the .htaccess file. Uncomment or add this line:

# RewriteBase /myrailsapp

to

RewriteBase /myrailsapp

Then change the line to match your folder’s name:

RewriteBase /rails2

Now, you have 2 Rails applications running on your domain. You would even be able to add more Rails applications using this same method.

Have fun Riding the Rails!

Archives

Categories

View more:

  • About the Lunarpages blog
  • Best Blog Hosting Guide
  • BOTW.org 40% Discount
  • Contact Lunarpages
  • Free Online Tools
  • Free Webmaster Downloads
  • Free Wordpress Themes

Best Web Hosting

Lunarpages.com Web Hosting

Recent Posts

  • Customer Showcase – SportVision
  • 5 Mobile App Trends for 2012
  • 10 Technology Trends for 2012
  • 5 Open Source CMS for Websites
  • Google Will Change Your Web Marketing in 2012

Recent Comments

  • Anonymous on 10 Best Google AdSense WordPress Plugins
  • best seo forums on 5 Reasons Why VPS Hosting May Be the Solution You’ve Been Searching For
  • Roger on 5 Mobile App Trends for 2012
  • Web Hosting Reviews on 2012 Resolutions Promotion
  • Graham Gillen on Plesk 9.5.2 Backup Tutorial

@Lunarpages Feed

Who We Are

  • Web Hosting Services
  • About us
  • Partners
  • Affiliate Program
  • Specials
  • 24/7/365 Support Desk
  • Community Forum
  • WIKI

Our Products

  • Colocation Services
  • Fully Managed Services
  • Dedicated Hosting
  • VPS Hosting
  • Microsoft Exchange
  • Open-Xchange
  • Fax To Email
  • Linux Hosting
  • Windows Hosting
  • Reseller Hosting
  • Quicksite Website Builder
  • SEO & SEM Services
  • Payment Processing
  • SecureLive Website Security
  • Tremendesk - Help Desk Solution

Connect With Us

Stay in touch with us!

Sign up for our monthly newsletter to receive updates, news, and current promotions!

Twitter
Facebook Google+ RSS Feed


© 2000 - 2011 Add2Net, Inc. "Lunarpages", "Add2Net" and the "Lunar Symbol" are the trademarks or the Registered trademarks of Add2Net, Inc.
All rights reserved. Unauthorized use is prohibited.