Deploying a Rails Application with Passenger

This guide will show you how to deploy your Rails application with mod_rails on our cPanel-based hosting systems. This is by far the easiest way to deploy your Rails application, and is now the recommended method of deployment.

Grid-Based Shared Hosting

For help with deploying Rails applications on our non-cPanel hosting systems, please see this guide.

cPanel-based Web Hosting

To use an existing Rails application with mod_passenger on our cPanel servers, simply upload it to a directory in your home directory (we recommend rails_apps/yourapp, where yourapp is a short name for your application). You will also need to setup your database settings if you have not already done so.

Setting the PassengerAppRoot

In the public folder of your Rails app, create a blank .htaccess file and put the following line, replacing user with your cPanel/FTP/SSH username, and rails_apps/yourapp with the location you have deployed your Rails app to.

PassengerAppRoot /home/user/rails_apps/yourapp

Symlinking the Public Folder

If you want your Rails application to be on your main site (that is, when you go to yoursite.com, you get your Rails app), then run via SSH:

cd ~
mv public_html original_public_html
ln -s ~/rails_apps/yourapp/public public_html

Replace rails_apps/yourapp with the path to your Rails application.

Deploying to a Sub Folder

If you want to have your Rails application hosted from a sub-folder on your site, like www.yoursite.com/myrails instead of your main site, you’ll need to run via SSH:

cd ~
mkdir -p public_html
ln -s ~/rails_apps/yourapp/public public_html/myrails
cd ~/public_html

Replace yourapp with the correct name of your application and myrails with the sub folder you want to have host your Rails application.