Hi, I have purchased a VPS that has WHM cpanel. I have logged into the
root of my system using putty and installed ruby 1.9.3 via rvm and rails
3.2.9.
I have created a website in cpanel that has created a public_html
directory that is live and working on the web. I then created a simple
ruby website called blog in the public_html directory. My question is
how do I get the ruby application to run when someone visits
mysite.com/blog.
I have installed passenger but am confused if that is the best option to
run rails applications.
I'm a total novice and have no idea what im doing so any guidance would
be appreciated.
Passenger is a great option, and makes it really straightforward to stand up a Rails site on an Apache server. If you've already installed it and added the lines of code that the installer gave you to your master apache.conf file (the ones that set the PASSENGER_RUBY environment variable), then you will only need to:
1. Place the contents of your Rails app directory inside your public_html file, so the top level item you can see is /public_html/app, and
2. Edit your virtual host's conf file so the root is /path/to/public_html/public rather than /path/to/public_html. Note that you'll have to change this on two different lines in a standard conf file.
Restart your server, and you're done.
Here's an example conf file for one of my ghosts:
<VirtualHost *:80>
ServerAdmin me@example.com
ServerName railsapp.example.com
DocumentRoot /data/www/railsapp/public
<Directory /data/www/railsapp/public>
Options -Indexes FollowSymLinks -MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>