This document describes how to install a Sinatra web application. You can use Sinatra to quickly create web applications on the Ruby platform which you can register in cPanel's Application Manager interface (cPanel >> Home >> Software >> Application Manager).
- cPanel Technical Support does not provide assistance with the steps in this document.
- We recommend that only experienced system administrators perform these steps.
- We are not responsible for any data loss.
- 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.
- In this document,
userrepresents the cPanel user, and
frankrepresents the application's name.
For more information, read Sinatra's documentation.
Before you begin, make certain that the following EasyApache 4 RPMs exist on your server:
If you enable this module, the system will disable Apache's
ea-apache24-mod_envmodule allows you to add environment variables when you register your application. For more information about environment variables, read our Application Manager documentation.
If you need to install these RPMs, run the following command as the
To install the
sinatra Ruby gem, run the following command:
If you do not wish to use the
scl utility, perform the following steps to install the
sinatra Ruby gem:
Log in to the server as a cPanel user.
Add the following line to your shell's
rcfile (for example,
Log out of your terminal session, and log back in again.
You can also create an additional terminal session.
- Run the
gem install sinatracommand
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:
- Change to the application's directory
- Create the
app.rbfile with a text editor.
Add the process that you want the application to execute, for example:
For more information about how to add processes to the
app.ppfile, read Sinatra's documentation.
- Create the
config.rbfile with a text editor.
Add the following content to the file:
This step is optional. UAPI's
PassengerApps::register_application function performs an Apache restart, but may not execute immediately.
After you create the application's Apache configuration, 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).