Ruby on Rails

Deploying Ruby on Rails on Domain India: App Platform and VPS

By Domain India Team · DomainIndia EngineeringPublished 8 min read
Knowledge base article
Contents (8 sections)

Ruby on Rails needs a persistent Ruby process to serve requests, so where you host it decides how much of Rails you can use. This guide covers the options at Domain India, how a Passenger-based setup on a control panel works, and a full production deployment of a Rails 8 app on a VPS with Puma, nginx, PostgreSQL and free SSL.

Key takeaways

For a production Rails app, use a VPS (full control, background jobs, Action Cable) or the App Platform with the Dockerfile that Rails generates. Domain India shared hosting can't run Rails: the cPanel and DirectAdmin app tools are for Node.js and Python only, with no Ruby tool (checked 30 September 2026).

1. Choosing where to run Rails

OptionRuby versionApp serverBackground jobs and Action CableBest for
Shared hosting (cPanel, DirectAdmin)Not availableNo Ruby app toolNoNot suitable for Rails
App PlatformAny, from your DockerfilePuma (in the container)No WebSocketsRails apps without real-time features
VPSAny (rbenv or similar)Puma behind nginxYesProduction apps

Rails apps often grow a job queue (Solid Queue or Sidekiq) and real-time features (Action Cable). Both need long-running processes, which only a VPS provides here.

2. Why Rails doesn't run on shared hosting

On control-panel hosting, Ruby apps would normally run through a panel tool that starts Phusion Passenger. Domain India's cPanel and DirectAdmin servers have app tools for Node.js and Python only; there is no Ruby app tool (checked 30 September 2026). Shared hosting also stops long-running processes, so Sidekiq, Solid Queue workers and Action Cable could not run there anyway, and Redis is not available. Use the App Platform or a VPS for Rails.

3. Rails on the App Platform

Since Rails 7.1, rails new generates a production-ready Dockerfile. The Domain India App Platform builds apps from your own Dockerfile (only Node.js is detected automatically), deploys from GitHub with Deploy Now or with a deploy token, and includes a PostgreSQL database and free SSL on every plan.

Things to know:

  • There is no SSH access, so run migrations as part of the container start (the generated bin/docker-entrypoint runs db:prepare).
  • WebSockets are not supported, so Action Cable won't work.
  • There is no Redis add-on; Rails 8's Solid Cache and Solid Queue use the database instead.
  • Pushes don't deploy automatically; use Deploy Now or a deploy token in CI.

See getting started with the App Platform.

With a VPS you get full control: any Ruby version, any database, job workers and WebSockets. The stack here is Ruby 3.4 + Rails 8 + PostgreSQL + Puma + nginx + Let's Encrypt, on AlmaLinux 9 or Ubuntu 24.04.

  1. Install system packages.
    Build tools and libraries for Ruby, plus PostgreSQL and nginx (commands below).
  2. Create a deploy user.
    Run sudo useradd -m -s /bin/bash deploy, then create /var/www/rails_app owned by deploy.
  3. Install Ruby with rbenv.
    As the deploy user (commands below).
  4. Deploy the app.
    Clone it into /var/www/rails_app, install gems, prepare the database and precompile assets.
  5. Run Puma under systemd.
    Create the service file below.
  6. Put nginx in front.
    Serve public/ directly and proxy the rest to Puma.
  7. Get SSL.
    Run sudo certbot --nginx -d yourcompany.com once DNS points at the VPS.

System packages:

bash
# AlmaLinux 9 / Rocky Linux 9 (libyaml-devel is in CRB, certbot in EPEL)
sudo dnf install -y epel-release
sudo dnf config-manager --set-enabled crb
sudo dnf install -y git gcc gcc-c++ make patch openssl-devel libyaml-devel libffi-devel \
    readline-devel zlib-devel postgresql-server postgresql-devel nginx certbot python3-certbot-nginx
sudo postgresql-setup --initdb
sudo systemctl enable --now postgresql

# Ubuntu 24.04
sudo apt install -y git build-essential libssl-dev libyaml-dev libffi-dev libreadline-dev \
    zlib1g-dev postgresql libpq-dev nginx certbot python3-certbot-nginx

Ruby with rbenv (as the deploy user):

bash
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'eval "$(~/.rbenv/bin/rbenv init - bash)"' >> ~/.bashrc
source ~/.bashrc

rbenv install -l                 # list the current stable versions
RUBY_VERSION=3.4.7               # use the latest stable version from the list
rbenv install $RUBY_VERSION
rbenv global $RUBY_VERSION

Deploy the app:

bash
cd /var/www/rails_app
git clone https://github.com/yourcompany/your-app.git .
bundle config set --local deployment true
bundle config set --local without 'development test'
bundle install
RAILS_ENV=production bin/rails db:prepare
RAILS_ENV=production bin/rails assets:precompile

Puma service at /etc/systemd/system/rails-puma.service:

ini
[Unit]
Description=Puma Rails server
After=network-online.target postgresql.service
Wants=network-online.target

[Service]
Type=simple
User=deploy
WorkingDirectory=/var/www/rails_app
ExecStart=/home/deploy/.rbenv/shims/bundle exec puma -C config/puma.rb
Environment=RAILS_ENV=production
EnvironmentFile=/var/www/rails_app/.env
Restart=on-failure

[Install]
WantedBy=multi-user.target

Put RAILS_MASTER_KEY=... in /var/www/rails_app/.env and chmod 600 it. Puma listens on port 3000; keep that port closed in your firewall so only nginx reaches it.

nginx at /etc/nginx/conf.d/rails.conf:

nginx
upstream puma { server 127.0.0.1:3000; }

server {
  listen 80;
  server_name yourcompany.com;
  root /var/www/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-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
  }
}

Start everything, then get the certificate:

bash
sudo systemctl daemon-reload
sudo systemctl enable --now rails-puma nginx
sudo certbot --nginx -d yourcompany.com

On AlmaLinux, SELinux blocks nginx from proxying to Puma until you run sudo setsebool -P httpd_can_network_connect 1. Keeping the app under /var/www (not a home folder) lets nginx read public/ without extra SELinux changes.

For background jobs, add a second systemd service for Solid Queue (bin/jobs) or Sidekiq; see our Sidekiq article.

5. Database setup

On shared hosting, create a MySQL database and user in the control panel. config/database.yml:

yaml
production:
  adapter: mysql2
  host: localhost
  database: cpaneluser_railsprod
  username: cpaneluser_railsusr
  password: <%= ENV['DB_PASSWORD'] %>
  encoding: utf8mb4
  pool: 5

On a VPS with PostgreSQL, create a role with the same name as the Linux user, so Rails can log in over the local socket without a password:

bash
sudo -u postgres createuser deploy
sudo -u postgres createdb -O deploy rails_prod

config/database.yml:

yaml
production:
  adapter: postgresql
  database: rails_prod
  username: deploy
  pool: 5

Leaving out host makes Rails use the Unix socket, where PostgreSQL's default peer authentication matches the Linux user to the database role.

6. Assets: Propshaft and import maps

Rails 8 uses Propshaft for assets and import maps for JavaScript by default, so you don't need Node.js to build assets:

bash
RAILS_ENV=production bin/rails assets:precompile

This writes fingerprinted files to public/assets/, which nginx (or Passenger) serves directly.

If your app uses a JavaScript bundler (esbuild, Vite, or Tailwind's standalone CLI through tailwindcss-rails), the build must run somewhere with the right tools: on your own computer or in CI before you deploy, or on the VPS.

7. Common pitfalls

cannot load such file -- bundler/setup
The app server isn't using your app's Gemfile. Check that the app root is the Rails folder (the one containing config/environment.rb), not public/.
Assets return 404
You forgot assets:precompile, or the web server's root isn't the app's public/ folder.
Mysql2 SSL connection error on shared hosting
Connect on localhost (socket) and remove any ssl_mode settings from database.yml.
Pages broken after the first load behind Cloudflare
A Cache Everything rule is caching logged-in or admin pages. Add a Cache Rule that bypasses the cache for admin paths and session cookies.
502 Bad Gateway on AlmaLinux
SELinux is blocking nginx. Run setsebool -P httpd_can_network_connect 1.
Logs growing to gigabytes
Rails 8 logs to STDOUT by default, which the systemd journal rotates. If you log to files, set up logrotate.

8. Running Rails on Domain India

  • VPS: the recommended home for production Rails. Domain India VPS plans are self-managed with full root access on KVM; you install and patch Ruby, PostgreSQL and nginx yourself. Plans start from ₹553 a month, excluding 18% GST (Domain India list price on 30 September 2026). No backups or snapshots are included, so schedule your own database dumps and copy them off the server.
  • App Platform: Dockerfile deploys with PostgreSQL and free SSL; no SSH, no Redis, no WebSockets.
  • Shared hosting: not for Rails; there is no Ruby app tool on cPanel or DirectAdmin.
Which Ruby version should I use?

The latest stable Ruby release that your gems support. Rails 8 needs Ruby 3.2 or later. On a VPS, rbenv lets you install any version and switch per app.

Can I run Rails on Domain India shared hosting?

No. Domain India's cPanel and DirectAdmin servers have app tools for Node.js and Python only, not Ruby. For production Rails, use a VPS or the App Platform.

Can I use Sidekiq or Solid Queue on shared hosting?

No. Both need a worker process that stays running, and long-running processes are stopped on Domain India shared hosting. Sidekiq also needs Redis, which shared hosting doesn't offer. Use a VPS.

Does Domain India support Action Cable and WebSockets?

On a VPS, yes: you control nginx and can proxy WebSocket connections. The App Platform does not support WebSockets, and shared hosting stops long-running processes. A third-party service such as Pusher or Ably is another option.

How do I debug a 500 error?

Read log/production.log (or journalctl -u rails-puma on a VPS). Temporarily set config.log_level = :debug to see more, and set it back afterwards. Never enable consider_all_requests_local in production, because it shows error details to visitors.

Is there a discount code for Rails developers?

Domain India doesn't offer coupon codes. The order page shows any discount available for longer billing periods.

Ready to deploy Rails? Choose a VPS plan for full control, try the App Platform with your Rails Dockerfile, or ask us through a support ticket which option fits your app.

Deploy Rails on a VPS

Root access for any Ruby version, PostgreSQL, job workers and Action Cable.

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
Deploy Ruby on Rails: cPanel Passenger, DirectAdmin, VPS