Just Host Web Hosting Help
Ruby on Rails Setup
- Create your Rails Application
- Access Your RoR Application
- Setup the .htaccess file
- Configure your .bashrc
Create your Rails Application
- Install whatever version of rails you want (provided it's compatible with ruby 1.9.3) as a local user: gem install rails --no-rdoc --no-ri
-
Create a new Rails application.
Rails 3.x
rails new ~/APPNAME -d mysql
gem install rails -v 3.0.11 --no-rdoc --no-ri
)
You may also use Rails v. 2.x for your app using the following syntax
Access Your RoR Application
If you are using a subdomain you can use the following steps to create the subdomain.
- Log into your justhost control panel
- Select 'Subdomains' from the 'Domains' section
- In the small form that loads, type in the name of your subdomain (example 'APPNAME')
- From the drop down box select which domain you want to create that subdomain on.
- Make sure the "Document Root" box points to the folder you want the subdomain to be tied to. In this case, we want it to point to the public_html/APPNAME folder that we just created.
ln -s ~/APPNAME/public ~/public_html/APPNAME
Setup the .htaccess file
You'll need this in public folder for the app which sets everything up including where to look for user-installed gems. To add this simply run the following commands:rm ~/APPNAME/public/.htaccess
vim ~/APPNAME/public/.htaccess
- Press i to edit the file.
- Paste in the code from below.
- Enter :wq
- Press Enter to save the changes.
<IfModule mod_passenger.c>
Options -MultiViews
PassengerResolveSymlinksInDocumentRoot on
#Set this to whatever environment you'll be running in
RailsEnv production
RackBaseURI /
SetEnv GEM_HOME /home1/examplec/ruby/gems
</IfModule>
Configure your .bashrc
You will need to add the following to your ~/.bashrc file.~/.bashrc file
export HPATH=$HOME
export GEM_HOME=$HPATH/ruby/gems
export GEM_PATH=$GEM_HOME:/lib64/ruby/gems/1.9.3
export GEM_CACHE=$GEM_HOME/cache
export PATH=$PATH:$HPATH/ruby/gems/bin
export PATH=$PATH:$HPATH/ruby/gems