Updated on: Dec. 20th, 2011
A step-by-step guide for getting Ruby on Rails (1.9.x/3.x) working on Ubuntu 11.x and Nginx.

Basics

Update the system:

Install the essentials: Build system, NodeJS, Nginx

Security

Add a bit of security:

Ruby

Install Ruby using RVM.

NOTE: I recommend relaunching your shell session to allow RVM to load properly.

Install Ruby:

Rails, and thin

Install Rails:

And, thin:

Install the thin daemon:

Because RoR and gang were installed via RVM, we need to make certain that thin (daemon) loads through the proper environment. This can be accomplish by creating a RVM wrapper for thin.

This will create the following script /usr/local/bin/daemon192_thin. Edit /etc/init.d/thin, and change the following line from:

…to:

thin daemon Configuration

For the purposes of this section, it’s assumed that target RoR application is in the following directory: /var/www/myapp.
Create a thin configuration file (Note: Remember to update path for your application):

This will generate a thin configuration file that will spawn (4) thin processes (cluster).
To start, and stop the thin damon:

Nginx

Simple nginx configuration to proxy thin cluster.

Johanns

Tagged with:
 

Comments are closed.