Super easy SUB-URI hosting with mod_rails
With an Amazon EC2 instance up, next very obvious task was to get the hosting up. Objective was to host static content along with multiple Rails apps on the same EC2 instance. Purists might not agree to this, but getting up and running was the first target.
Apache is configured with DocumentRoot as /mnt/app/shared
My Rails apps live inside /mnt/app/releases/<app_name>/<app_dir_structure>
<app_name_1> should be exposed as http://blah-blah.com/dev
/etc/apache2/sites-available/ looks like
<VirtualHost *:80>DocumentRoot /mnt/app/sharedRailsBaseURI /dev</VirtualHost><VirtualHost *:80>
DocumentRoot /mnt/app/shared
RailsBaseURI /dev
</VirtualHost>
(This is important)
Inside the /mnt/app/shared directory, my /dev symlink now points to /mnt/app/releases/<app_name_1>/public
And inside my <app_name_1>/config/environment.rb, just before the Initializer block ends, add
config.action_controller.relative_url_root = "/dev"
And you’r done! Touch the <app_name_1>/tmp/restart.txt file and reload your app in the browser! It should be running!
Some excellent material to read before attempting this…
Oh yeah, the AMI being used is Webficient’s Ubuntu 8.04 image, with Rails 2.3.2, passenger, etc etc.
Next target – move over the configuration to Puppet!
Good Luck
Related posts:
- How to create subdomains for domains bought via Google Apps (Enom) This was supposed to be the easiest thing (as...
- Location of Rubygems in Ubuntu Jaunty With Jaunty, the location of installed gems has been...
- Running Ubuntu inside Win-XP I’m nothing short of saying – “Holy cows”!! Check...
Related posts brought to you by Yet Another Related Posts Plugin.
About this entry
You’re currently reading “Super easy SUB-URI hosting with mod_rails,” an entry on Dare to Dream?
- Published:
- 08.28.09 / 1am
- Category:
- A strong urge to blog..., Cloud Computing, Just for archive, Rails, Ruby
1 Comment
Jump to comment form | comments rss [?] | trackback uri [?]