If you are planning to deploy your Rails application using Capistrano 3, RVM, Unicorn, and Nginx then this is for you. You can follow these steps to help you automate your deployment to your cloud server. If you want to secure your server, you can read through this.

Install RVM

Log in to your system and install RVM. RVM has a good installation guide which you can find in detail here.

Install Git

For Ubuntu:

$ sudo apt-get install git

If you are running on CentOS

$ sudo yum install git

To check whether it installed correctly

$ git --version
git version 1.8.3.2

Setup Nginx

Nginx is a reverse proxy server. It basically serves all the client requests coming in to your server, and directs it to the appropriate backend server. In this case, your backend server would be Unicorn which hosts your Rails application.

Installing Nginx is simple with the package management tool.

For Ubuntu

sudo apt-get install nginx

For CentOS

sudo yum install nginx

Once you have this installed, you will need to add default.conf.

$ sudo vim /etc/nginx/conf.d/default.conf

Add the following content. Make sure to edit it to match your configurations