This article describes how to use the Setup Ruby App feature in cPanel to configure and run a Ruby on Rails application in a shared hosting environment.
First, you must create the application in cPanel using the Setup Ruby App feature. To do this, follow these steps:
If you are using the Paper Lantern theme, in the SOFTWARE section of the cPanel home page, click Setup Ruby App:
On the Setup Ruby App page, under Setup New Application, do the following:
At this point you have created the Ruby on Rails environment in cPanel. Now you are ready to create and configure the Rails application itself. To do this, follow these steps:
(railsapp:2.5)[email protected] [~]#
Type the following command:
You must run this command every time after you activate the virtual environment. Alternatively, you can combine this command with the command above to activate the virtual environment. For example:
source /home/username/rubyvenv/railsapp/2.5/bin/activate && unset XDG_RUNTIME_DIR
To back up the config.ru file, type the following commands. Replace railsapp with the name of your own application directory:
cd ~/railsapp mv config.ru config.ru.bak
To create the Rails application, type the following command. Replace railsapp with the name of your own application directory:
rails new ~/railsapp
To add a default route, open the config/routes.rb file in your preferred text editor. Add the following line after the Rails.application.routes.draw do line:
If the Ruby on Rails application does not work correctly, you can check the application log files for errors. The application log files are located in the log directory (for example, ~/railsapp/log). There are separate log files for each environment:
If you need further assistance, please open a support ticket with our Guru Crew on the Customer Portal at https://my.a2hosting.com.
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.