Our documentation is getting an overhaul! We would like your input! Click here to take a look at the beta launch of our new documentation site! Only cPanel & WHM version 82 documentation exists on our beta at this time. 84 will be added to the new site soon! Leave your feedback here: https://go.cpanel.net/docsfeedback
How to Create a Sinatra Ruby Application - cPanel Knowledge Base - cPanel Documentation
Page tree
Skip to end of metadata
Go to start of metadata



  • cPanel Technical Support doesn't provide assistance with the steps in this document. We are not responsible for any data loss.
  • We recommend that only experienced users perform these steps.
  • Before you begin, your hosting provider must enable the feature and install some EasyApache 4 RPMs.

This document describes how to install a Sinatra web application. You can use Sinatra to quickly create web applications on the Ruby platform. Then, you can register them in cPanel's Application Manager interface (cPanel >> Home >> Software >> Application Manager).


  • We recommend that you perform the steps in this document via the command line as a cPanel user unless otherwise specified.
  • You can also use cPanel's Terminal interface ( cPanel >> Home >> Advanced >> Terminal) to perform these steps in cPanel & WHM version 72 and later.
  • To use this feature, the cPanel account must possess compiler access in WHM's Compiler Access interface (WHM >> Home >> Security Center >> Compiler Access). If the account does not possess compiler access, the system will return an error similar to the following message:

    make: execvp: gcc: Permission denied
  • For more information, read Sinatra's documentation.

Install Sinatra

Install the sinatra gem.

To install the sinatra Ruby gem, run the following command:

scl enable ea-ruby24 'gem install sinatra'

If you do not wish to use the scl utility, perform the following steps to install the sinatra Ruby gem:

  1. SSH in to your cPanel account.

  2. Add the following line to the rc file (for example, /home/user/.bashrc):

    source /opt/cpanel/ea-ruby24/enable
  3. Log out of your session and then SSH in again.

  4. Run the gem install sinatra command.

Create the application's directory path.

After you install the sinatra Ruby gem, create the application's directory path, relative to your home directory. For example:


Create the application's Ruby files.

After you create the application's directory path, add the Ruby application file. To do this, perform the following steps:

  1. Navigate to the application's directory.
  2. Create the app.rb file and add the code for the application to execute. For example:

    require 'sinatra/base'
    class Example < Sinatra::Base
      get '/' do

    For more information about how to add processes to the app.rb file, read Sinatra's documentation.

  3. Create the config.rb file with the following content:

    require File.absolute_path("app.rb")
    run Example

Register the application.

After you set the file permissions, register the application. To do this, use either of the following methods:

Restart Apache.


  • This step requires root-level permissions on the server.
  • This step is optional. UAPI's PassengerApps::register_application function restarts Apache, but it may not do this immediately.

After you create the application's Apache configuration file, restart Apache. To do this, run the following command as the root user:


After Apache restarts, you can access the application in cPanel's Application Manager interface (cPanel >> Home >> Software >> Application Manager).

 Additional documentation