How To Set Up A Rails Application On Main Domain With Passenger?


Upload your application to the server using either ftp/sftp or SSH or if you have your application under version control, checkout or clone your application to a folder in your home directory.

–Next, we need address apache/passenger about your application, this is done by setting a symbolic link from your public_html directory to your applications public directory. Here in the following example my application name is “myapp”.

For example, if your application is in myapp then you would issue the following commands in an SSH session: (Make sure there is nothing you need in your /public_html directory as the following will remove everything in that directory)

rm -rf ~/public_html ln -s ~/myapp/public ~/public_html

–Now we need to enable passenger, this is done by creating a file called .htaccess in your application public directory. Add the following entries in the file ./public/.htaccess under the location of your application root.

RAILS-2.x.x

RailsBaseURI / PassengerAppRoot /home/myusername/myapp

RAILS-3.x.x

RackBaseURI / PassengerAppRoot /home/myusername/myapp –Next, Setup your database and a database user in cPanel, and update your config/database.yml with this new database name, user, and password.

–Migrate or import your database(The command to do this is “rake db:migrate” from your application root path)

–Make sure any third party gems you need are installed, you can view the gems installed by running gem list—local , if there is a gem missing, email support to request the gem to be installed.

You will now be able to access your rails application at your domain, if there are any deployment errors, passenger will display an error message which should help you determine how to fix the error.

 

Source: RailsCarma

Advertisements

One thought on “How To Set Up A Rails Application On Main Domain With Passenger?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s