cPanel 11 Stage 2 (currently in the most recent RELEASE build) have RoR functionality, including Rails and Gems options on cPanel.

Note: For RoR, Apache must have mod_proxy support.

How To Install Ruby on a cPanel Server

/scripts/installruby

How to Install and Setup Gems

Ruby Gems are collections of functions that allow you to perform tasks in Ruby. You will need to install a Gem before you can use it inside a Ruby program.

Note: Current cPanel version has some bugs or issue with Gem Setup. We may sometimes need to configure Gems and Rails from command line.

Install RubyGems
—————-

cd /usr/local/src
wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
tar xvzf rubygems-0.8.11.tgz
cd rubygems-0.8.11
ruby setup.rb all

This step involves execution of `ruby setup.rb` with arguments `config / setup / install` all together

gem query –local
OR
gem q -L

Listing all installed gems

Install Rails:
————–

gem install rails OR # (Enter Y for all dependencies)
gem install rails –include-dependencies

Note: maximum memory a cPanel process can be used must be set to a value greater than 128M (WHM > Server Configuration > Tweak Settings)

Location of Your Ruby Gem on Application(s)

Path: /home/username/ruby/gems

Using Your Ruby Gem(s)

You will need to add /home/username/ruby/gems to the include path. You can do this by adding the following code to your script:

$:.push(“/home/username/ruby/gems”)

Start And Stop Ruby Application

Once the setup is completed. You can start/stop the application using the Action button on cPanel

Set up a Redirection

The default port appears to be 12001, so the actual URL is: http://domain.com:12001/ ..which loads the app running at: /home/domain/path/to/rails/app/appname http://domain.com/Applnname to http://domain.com:12001/Applnname

You can set up this redirection using a .htaccess file inside the “Applnname” directory.

Here the complete installation process :

  1. /scripts/installruby (unfortunately it is currently not perfect, no idea why)
  2. Gem install rails
  3. Gem install mongrel
  4. Fastthread isn’t installed (normally you will be asked for fastthread during mongrel installation)
  5. Gem install fastthread

Don’t forget to open firewall ports 3000 and 12001

Photo by Joanna Kosinska on Unsplash