How to Create a Ruby App in cPanel with CloudLinux on Windows

How to Create a Ruby App in cPanel with CloudLinux on Windows?

Building a Ruby application and deploying it on a shared hosting environment like cPanel, powered by CloudLinux, can seem complex, especially when you’re working from a Windows-based development environment. However, with the right steps, it’s possible to make, upload, & run a Ruby app using cPanel’s Ruby Application Manager, even if you’re developing from Windows. In this tutorial, we’ll walk through everything you want to know: how to create a Ruby app in cPanel with CloudLinux on Windows, to deploying & managing it via cPanel on a CloudLinux server.

Prerequisites

What do you want before you begin:

    • A cPanel & CloudLinux-enabled hosting account (e.g., Oudel etc.)
    • Access to the Ruby App Manager in cPanel (ask your host)
    • A Windows Personal Computer with:
      • Ruby installed (using RubyInstaller)
      • A code editor (e.g., VSCode or Sublime Text)
      • An SFTP client like FileZilla or WinSCP
    • A easy Ruby web app (we’ll make a basic Sinatra app in this tutorial)

Step-1: Set Up Ruby Environment on Windows

  1. Install Ruby on Windows
    Download & install Ruby using RubyInstaller for Windows. Ensure to include MSYS2, which is sought after for compiling native gems.
  2. Installing Sinatra (or your desired framework)
    Sinatra is a lightweight Ruby web framework that is ideal for beginners.

    bash Copy
    gem install sinatra
  3. Makes a Easy App
    Here’s a sample app.rb file:

    ruby Copy
    require 'sinatra'
    get '/' do
    "Hello from Ruby on cPanel!"
    end
  4. Make a Gemfile
    ruby Copy
    source 'https://rubygems.org'
    gem 'sinatra'
  5. Bundle Your Gems (Optional for development)
    bash Copy
    gem install bundler
    bundle install
  6. Test the App Locally
    Run:

    bash Copy
    ruby app.rb

Visit http://localhost:4567 in your browser to ensure it works.

Step-2: Log Into cPanel & On Ruby App Supports

    1. Log-in to your cPanel account
    2. Locate “Setup Ruby App” under the Software section
      (This is available only if your host uses CloudLinux & on this feature.)
    3. Make a New Ruby App
      • Ruby version: Choose the version (e.g., 2.6 or 3.0)
      • App directory: e.g., rubyapp
      • App domain/URL: choose subdomain or main domain path
      • App startup file: e.g., config.ru or app.rb
      • Click Make
    4. Note the App Environment Path
      After creation, cPanel will show a virtual environment path (e.g., /home/username/rubyvenv/rubyapp/2.6/bin).

Step-3: Upload Your App from Windows

  • Use FileZilla, WinSCP, or the cPanel File Managers to upload your Ruby app.
  • Upload your project files (e.g., app.rb, Gemfile, etc.) to the app directory you defined in cPanel.
  • Make sure the file structure matches what you expect.

Step-4: Create a config.ru File

For apps like Sinatra, you want a Rack-compatible entry point, which is config.ru.

Example config.ru:

ruby   Copy
require './app'
run Sinatra::Application

Upload this file to the app’s root directory.

Step-5: Install Dependencies

Back in cPanel:

  • Navigate to “Setup Ruby App”
  • Search your app in the list & click Edit
  • Open the Terminal in cPanel or use SSH

Activate the app’s environment:

bash Copy
source /home/username/rubyvenv/rubyapp/2.6/bin/activate

Install dependencies:

bash Copy
cd /home/username/rubyapp
bundle install --deployment

Or, if you prefer using individual gem installs:

bash Copy
gem install sinatra

Step-6: Start the Application

Back in the cPanel Ruby App Manager:

  • Set the Application startup file to config.ru
  • Click Restart App
  • If everything is setting correctly, your app should now live at the defined URL (e.g., https://yourdomain.com/rubyapp).

Problem-Solved Tips

  • 500 Error? Check logs in /home/username/rubyapp/logs/ or from cPanel’s “Errors” viewer.
  • Gem not found? Ensure you use the right Ruby environment before installation.
  • Routing not working? Ensure you’ve config.ru as your startup file.

Bonus: Using Custom Domains & SSL

  • You can map a subdomain like ruby.yourdomain.com to your app path via:
  • Subdomains > create one pointing to your app folder.
  • SSL/TLS > Use Let’s Encrypt to install SSL.
  • Redirects or .htaccess can be used to ensure HTTPS routing.

Security Tips

  • Always keep your gems up to date (bundle update)
  • Use secure file permissions (avoid 777)
  • Avoid exposing your .env or secret configuration files

Final Thoughts

Making a Ruby app on cPanel with CloudLinux from a Windows machine may feel like bridging two different worlds—but it’s very doable with the right process. Whether you’re building a small web app, API, or prototyping a Ruby idea, cPanel’s Ruby App Manager gives you a shared hosting solution with dedicated app isolation and environment control.

Scroll to Top