Creating and running Ruby on Rails application through cPanel

Creating and Running a Ruby On Rails application in cPanel

Steps:

   1. Login to cPanel. (http://www.yourdomain.com/cpanel)
   2. Click on the icon for “Ruby on Rails”.
   3. Check the box for “Load on boot?”
   4. Fill in the “App Name” box with the application name”.
   5. Application Path will be automatically filled as public_html/application_name
   6. Select “production” for the Environment, which should already be selected as the default.
   7. Click “Create”

After starting the application, you can access it using the

URL : http://domainname/app_name/public/
Avoid : http://domainname/app_name/public

Each application will be using a port above 12000(>12000). The application will be automatically assigned a port when we are creating the application from cpanel.
Note : If we are creating the application under public_html directory, the application’s source code and
configuration files can be viewed by anyone on the web. So, to avoid this you have two options:

  • Create the application in the public_html directory and change config file permission to 600. Especially the database.yml (/home/username/public_html/application_name/config/database.yml) file in which all the mysql access details are specified.
  • Create the application in home directory and use the rewrite option.
You can create the application in the home directory (/home/username) and then use the rewrite option in cpanel(Cpanel >> Ruby On Rails >> Create A Rewrite).
On the right hand side of each application, click the link “Create Rewrite” and save the required rewrite rule.

For example: if you want to redirect the main domain to your rails application port, say http://domainname:12002, Select the main domain in “Domain & URL to be redirected to rails app” section and click save.

Similarly, you can redirect a subdomain to the rails application by selecting the corresponding subdomains from the list(Domain & URL to be redirected to rails app). But before that you should create that particular subdomain in cPanel.

  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

RoR Support Test

Question: How do I check Ruby on Rails is activated ? Answer: In our Ruby on Rails support you...

Ruby on Rails - Simple Test Application

Create the application from cpanel, for example: Application name : exampleGenerate the test...