Ruby on Rails

Deploying Ruby on Rails on DomainIndia Hosting (cPanel Passenger, DirectAdmin, VPS)

By Domain India Team · DomainIndia EngineeringPublished · Updated 6 min read
Knowledge base article
Contents (8 sections)
TL;DR

Ruby on Rails runs well on DomainIndia — shared cPanel (with Passenger), DirectAdmin (Passenger), or VPS (any Ruby version + any app server). This guide covers Ruby version selection, gem install, database config, and going live for a production Rails 7/8 app.

Choosing a plan

PlanRuby versionApp serverBest for
Shared cPanel3.0 / 3.2 (Passenger)Passenger (Apache)Small business sites, blogs, MVPs
Shared DirectAdmin3.0 / 3.2PassengerSame as above
VPSAny (rbenv / rvm)Puma, Unicorn, PassengerProduction apps, larger traffic, multi-worker

Rails needs persistent Ruby processes. On shared hosting our Passenger integration handles this. For heavier sites (>1,000 concurrent users, Sidekiq workers, ActionCable WebSockets), go with a VPS.

Option A — Rails on shared cPanel with Passenger

cPanel ships with Passenger built in. The "Setup Ruby App" tool gives you a point-and-click setup.

  1. Log in to cPanel → search "Setup Ruby App" (under "Software")
  2. Click "Create Application"
    • Ruby version: 3.2.x (recommended for Rails 7.x+)
    • Application mode: Production
    • Application root: rails_app (the folder under your home directory)
    • Application URL: your domain or subdomain
  3. Click Create — cPanel builds a .htaccess + Passenger config
  4. In Terminal (cPanel → Terminal):
    bash
    source /home/$USER/rubyvenv/rails_app/3.2/bin/activate
    cd ~/rails_app
  5. Clone your Rails app:
    bash
    git clone https://github.com/yourcompany/your-app.git .
  6. Install gems (might take 5–10 min):
    bash
    bundle config set --local deployment 'true'
    bundle config set --local without 'development test'
    bundle install
  7. Set environment variables in cPanel Setup Ruby App → "Environment variables":
    • RAILS_ENV=production
    • RAILS_MASTER_KEY=<from config/master.key>
    • DATABASE_URL=mysql2://user:pass@localhost/db_name
  8. Run database migrations from Terminal:
    bash
    bundle exec rake db:migrate RAILS_ENV=production
  9. Precompile assets:
    bash
    bundle exec rake assets:precompile RAILS_ENV=production
  10. Click "Restart" in Setup Ruby App to reload Passenger
Info

Use MySQL/MariaDB on shared, not PostgreSQL. Our shared plans provision MySQL by default. Rails's mysql2 gem works perfectly. If you need PostgreSQL, order a VPS.

Option B — Rails on DirectAdmin with Passenger

DirectAdmin also supports Ruby via Passenger. Pre-check: ask our support to confirm Passenger is enabled on your server.

  1. Create a subdomain or domain in DirectAdmin
  2. Upload/clone your Rails app to ~/domains/yourcompany.com/public_html/ — or a sibling folder like ~/rails_app with public_html symlinked
  3. Create .htaccess with:
    apache
    PassengerAppRoot /home/$USER/rails_app
    PassengerRuby /home/$USER/.rvm/wrappers/ruby-3.2.0/ruby
    PassengerPython /usr/bin/python3
  4. SSH in, install rvm/rbenv:
    bash
    curl -sSL https://get.rvm.io | bash -s stable
    source ~/.rvm/scripts/rvm
    rvm install 3.2.0
  5. cd ~/rails_app && bundle install
  6. Set ENV vars in ~/rails_app/.env (if using the dotenv gem)
  7. Migrate + precompile as in Step 8–9 above
  8. Touch ~/rails_app/tmp/restart.txt to reload Passenger

With a VPS you get full control — any Ruby version, any database, Sidekiq workers, WebSockets, etc.

Typical stack: Ruby 3.3 + Rails 8 + PostgreSQL + Redis + Puma + nginx + Let's Encrypt SSL.

  1. Provision AlmaLinux 9 or Ubuntu 22.04 VPS from DomainIndia
  2. Install system deps:
    bash
    sudo dnf install -y git postgresql postgresql-server redis nginx certbot
    # or on Ubuntu:
    sudo apt install -y git postgresql postgresql-contrib redis nginx certbot
  3. Install rbenv + Ruby:
    bash
    git clone https://github.com/rbenv/rbenv.git ~/.rbenv
    git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
    ~/.rbenv/bin/rbenv install 3.3.0
    ~/.rbenv/bin/rbenv global 3.3.0
  4. Clone app, install gems, migrate, precompile (same as Option A step 5–9)
  5. Create a systemd service for Puma at /etc/systemd/system/rails-puma.service:
    ini
    [Unit]
    Description=Puma Rails server
    After=network.target
    [Service]
    Type=simple
    User=deploy
    WorkingDirectory=/home/deploy/rails_app
    ExecStart=/home/deploy/.rbenv/shims/bundle exec puma -C config/puma.rb
    Restart=on-failure
    Environment=RAILS_ENV=production
    [Install]
    WantedBy=multi-user.target
  6. Create nginx reverse proxy at /etc/nginx/conf.d/rails.conf:
    nginx
    upstream puma { server 127.0.0.1:3000; }
    server {
      listen 80;
      server_name yourcompany.com;
      root /home/deploy/rails_app/public;
      try_files $uri @puma;
      location @puma {
        proxy_pass http://puma;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
      }
    }
  7. Get SSL: sudo certbot --nginx -d yourcompany.com
  8. Start services:
    bash
    sudo systemctl enable --now rails-puma nginx
  9. For background jobs, set up a second systemd service for Sidekiq (see our "Background Jobs & Queues" article)

Database setup

On shared hosting, create MySQL DB via cPanel → MySQL Databases. Rails config/database.yml:

yaml
production:
  adapter: mysql2
  host: localhost
  database: cpanel_user_rails_prod
  username: cpanel_user_railsusr
  password: <%= ENV['DB_PASSWORD'] %>
  pool: 5

On VPS with PostgreSQL:

bash
sudo -u postgres createdb rails_prod
sudo -u postgres createuser deploy
sudo -u postgres psql -c "ALTER USER deploy WITH ENCRYPTED PASSWORD 'secret';"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE rails_prod TO deploy;"

config/database.yml:

yaml
production:
  adapter: postgresql
  database: rails_prod
  host: localhost
  username: deploy
  password: <%= ENV['DB_PASSWORD'] %>
  pool: 5

Asset pipeline — propshaft + importmaps (Rails 7+)

Rails 7+ ships with propshaft (simpler than sprockets) and importmaps (no Node required). On shared hosting this is gold — no webpack, no esbuild, no Node.js setup needed.

bash
bundle exec rake assets:precompile RAILS_ENV=production

outputs to public/assets/ with fingerprinted filenames. Passenger + nginx serve these directly.

For apps that need Node (React via esbuild, Tailwind JIT), you need the Node.js build to run somewhere — either locally before git push (commit public/assets/ to repo) or on a VPS with Node installed.

Common pitfalls

"Cannot load such file -- bundler/setup"
Passenger isn't using your project's Gemfile. Check PassengerAppRoot is the Rails app folder (containing config/environment.rb), not the public/ subfolder.
Assets return 404
forgot assets:precompile, or nginx serves public/ from the wrong path.
"ActiveRecord::StatementInvalid: Mysql2::Error: SSL connection error"
on shared hosting, MySQL connects via socket. Remove host from database.yml or set host: localhost with no ssl_mode field.
Site works on first load, broken on second
you're behind Cloudflare with Cache Level: Cache Everything. Add a Page Rule bypassing cache for /rails_admin/* or any admin paths.
Logs grow to GB
rotate: add to config/environments/production.rbconfig.logger = ActiveSupport::Logger.new(STDOUT) (systemd handles rotation) or use logrotate on VPS.

FAQ

Which Ruby version should I pick?

Latest stable — Ruby 3.3.x in 2026. Rails 8 requires Ruby 3.1+. On shared hosting we provide 3.0, 3.2, and (on newer servers) 3.3.

Can I use Sidekiq on shared hosting?

No — Sidekiq needs a long-running Redis instance + worker processes. Shared plans don't allow background daemons. Upgrade to VPS.

Does DomainIndia support ActionCable / WebSockets?

Not reliably on shared (Passenger WebSocket support is limited). Use VPS for real-time features. Alternatively, use third-party services like Pusher or Ably.

How do I debug a 500 error on Passenger?

Tail ~/logs/passenger.log and ~/rails_app/log/production.log. Enable config.consider_all_requests_local = false in production, but config.log_level = :debug temporarily while troubleshooting.

Is there a DomainIndia promo code for Rails developers?

Annual plans include 10%+ discount built in. See our VPS plans or cPanel hosting.

Ready to deploy Rails? Our VPS plans come with root SSH and any stack you want. Explore VPS plans

Was this article helpful?

Your answer helps us decide what to improve next.

Still need help? Open a support ticket and our team will reply.

Prefer an app? Add this site to your home screen.Get the app