Skip to content

Configuring a Ruby on Rails application on a shared hosting account

Configuring a Ruby on Rails application on a shared hosting account
Learn how to use the Setup Ruby App feature in cPanel to configure and run a Ruby on Rails application.

  1. Log in to cPanel.

  2. On the Tools page, in the Software section, click Setup Ruby App.

  3. Under Setup New Application:

    • Select Ruby version 2.5.
    • In App Directory, type the directory name (example: railsapp).
    • Select your domain and enter the URI.
    • Click Setup.
  4. Under Existing applications, locate your app.

  5. In the modules row, click show.

  6. In the field beside Add, type rails, then click Add.

  7. Click Update to install the Rails module.

  8. Copy the full source command shown next to Command for entering to virtual environment. You’ll need it for the next step.

Step 2: Configure the application from the command line

Section titled “Step 2: Configure the application from the command line”
  1. Log in using SSH.
  2. Paste and run the source command you copied earlier to activate the virtual environment.
  3. Run:
Terminal window
unset XDG_RUNTIME_DIR
  1. Back up the config.ru file:
Terminal window
cd ~/railsapp
mv config.ru config.ru.bak
  1. Create the Rails application:
Terminal window
rails new ~/railsapp
  1. Open config/routes.rb and add this line after Rails.application.routes.draw do:
root 'rails/welcome#index'
  1. Save the file.
  2. Go back to cPanel, locate the application under Existing applications, and click Restart.
  3. Open your application’s URI in a browser. You should see the Yay! You’re on Rails page.

If you need more help, you can open a support ticket in your hosting control panel.

  • Rails Getting Started Guide: guides.rubyonrails.org
  • Rails API Documentation: api.rubyonrails.org