Call Us: 992 9441 754

Complete Guide to Setting Up Ruby on Rails 3 on WHM (CentOS)

< All Topics

Complete Guide to Setting Up Ruby on Rails 3 on WHM (CentOS)

Running Ruby on Rails 3 on a WHM (Web Host Manager) server with CentOS involves several steps, including installing Ruby, setting up Rails, configuring Apache or Nginx, and integrating with cPanel if necessary. Here’s a step-by-step guide to get you started:


  • A server running CentOS with WHM/cPanel installed.
  • Root access to the server.

Step-by-Step Guide

  1. Access Your Server:
    Connect to your server via SSH.
  1. Install Required Dependencies:
    Update your package list and install necessary dependencies.
  1. Install RVM (Ruby Version Manager):
    RVM makes it easy to install and manage different Ruby versions.

Add your user to the RVM group:

  1. Install Ruby:
    Use RVM to install Ruby 1.9.3, which is compatible with Rails 3.
  1. Install Rails:
    Install Rails 3 using the gem command.
  1. Set Up Your Rails Application:
    Create a new Rails application or move an existing one to your server.

If you have an existing application, just move it to your server.

  1. Install Passenger:
    Passenger is a web and application server for Ruby, Python, and Node.js. It integrates well with Apache and Nginx.

Follow the instructions provided by the Passenger installer to configure Apache.

  1. Configure Apache with Passenger:
    Edit your Apache configuration file to include Passenger settings.

Add the following lines at the end of the file:

Replace /path/to/your/app with the path to your Rails application and with your domain.

  1. Restart Apache:
    Restart Apache to apply the changes.
  1. Integrate with cPanel (Optional):
    If you need to integrate Rails with cPanel, you may need to manually configure each domain or subdomain through cPanel’s interface to point to your Rails application. This typically involves setting up the domain, creating the appropriate directory structure, and configuring the Apache virtual hosts as described above.

Additional Tips

  • Database Configuration: Ensure your database (MySQL, PostgreSQL, etc.) is configured correctly in your config/database.yml file.
  • Environment Variables: Set any necessary environment variables in your .bashrc or .bash_profile.
  • SSL Configuration: If your application requires SSL, configure your virtual host for HTTPS.

By following these steps, you should be able to set up and run a Ruby on Rails 3 application on a WHM/cPanel server with CentOS. If you encounter any issues, refer to the logs and error messages for troubleshooting.


Recent Comments

No comments to show.