Deploying Ruby on Rails on DomainIndia Hosting (cPanel Passenger, DirectAdmin, VPS)
Choosing a plan
| Plan | Ruby version | App server | Best for |
|---|---|---|---|
| Shared cPanel | 3.0 / 3.2 (Passenger) | Passenger (Apache) | Small business sites, blogs, MVPs |
| Shared DirectAdmin | 3.0 / 3.2 | Passenger | Same as above |
| VPS | Any (rbenv / rvm) | Puma, Unicorn, Passenger | Production 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.
- Log in to cPanel → search "Setup Ruby App" (under "Software")
- 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
- Click Create — cPanel builds a
.htaccess+ Passenger config - In Terminal (cPanel → Terminal):
```bash
source /home/$USER/rubyvenv/rails_app/3.2/bin/activate
cd ~/rails_app
```
- Clone your Rails app:
```bash
git clone https://github.com/yourcompany/your-app.git .
```
- Install gems (might take 5–10 min):
```bash
bundle config set --local deployment 'true'
bundle config set --local without 'development test'
bundle install
```
- 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
- Run database migrations from Terminal:
```bash
bundle exec rake db:migrate RAILS_ENV=production
```
- Precompile assets:
```bash
bundle exec rake assets:precompile RAILS_ENV=production
```
- Click "Restart" in Setup Ruby App to reload Passenger
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.
- Create a subdomain or domain in DirectAdmin
- Upload/clone your Rails app to
~/domains/yourcompany.com/public_html/— or a sibling folder like~/rails_appwithpublic_htmlsymlinked - Create
.htaccesswith:
```apache
PassengerAppRoot /home/$USER/rails_app
PassengerRuby /home/$USER/.rvm/wrappers/ruby-3.2.0/ruby
PassengerPython /usr/bin/python3
```
- SSH in, install rvm/rbenv:
```bash
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm install 3.2.0
```
cd ~/rails_app && bundle install- Set ENV vars in
~/rails_app/.env(if using thedotenvgem) - Migrate + precompile as in Step 8–9 above
- Touch
~/rails_app/tmp/restart.txtto reload Passenger
Option C — Rails on VPS (recommended for production)
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.
- Provision AlmaLinux 9 or Ubuntu 22.04 VPS from DomainIndia
- 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
```
- 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
```
- Clone app, install gems, migrate, precompile (same as Option A step 5–9)
- 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
```
- 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;
}
}
```
- Get SSL:
sudo certbot --nginx -d yourcompany.com - Start services:
```bash
sudo systemctl enable --now rails-puma nginx
```
- 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:
production:
adapter: mysql2
host: localhost
database: cpanel_user_rails_prod
username: cpanel_user_railsusr
password: <%= ENV['DB_PASSWORD'] %>
pool: 5On VPS with PostgreSQL:
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:
production:
adapter: postgresql
database: rails_prod
host: localhost
username: deploy
password: <%= ENV['DB_PASSWORD'] %>
pool: 5Asset 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.
bundle exec rake assets:precompile RAILS_ENV=productionoutputs 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
FAQ
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.
No — Sidekiq needs a long-running Redis instance + worker processes. Shared plans don't allow background daemons. Upgrade to VPS.
Not reliably on shared (Passenger WebSocket support is limited). Use VPS for real-time features. Alternatively, use third-party services like Pusher or Ably.
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.
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