Nginx is a lightweight, high-performance web server. Passenger used with Nginx gives us many advantages. It automatically serves static assets from the public subdirectory to improve performance. Capistrano is used to automate deployment process to your remote server. Using Capistrano, you can deploy your web application on many servers simultaneously in sequence or as a rolling set.

In this article, we will see basic steps that need to be followed to configure your DigitalOcean Ubuntu Droplet.


  • Ubuntu 16.04 x64 Droplet
  • Working Rails app hosted in a remote git repository that's ready to be deployed

Initial setup for the droplet server

1. Initiate a connection:

You first need to know your server's IP address and password of the root user to login into your droplet server. Enter the following command in your terminal to connect to the droplet as a root user using ssh with your server's IP at the place of SERVER_IP_ADDRESS.

            ssh root@SERVER_IP_ADDRESS

2. Create a user

The root user has the administrative access with heightened privileges. Due to which you are advised to create another user with fewer privileges. Here, add your username at the place of demo

            adduser demo

You will be asked few question along with account password. You can fill this information or skip just by hitting 'Enter' button.

3. SSH - Key Based Authentication

If you do not have SSH key pair i.e. public and private key then you need to generate one. Run the given command on your local terminal.


You will get the output similar to following:

ssh-keygen output
Generating public/private RSA key pair.
Enter file in which to save the key (/Users/LOCALUSER_NAME/.ssh/id_rsa):

Hit 'Enter' to accept the file name and path or you can also provide a new name. It will also prompt you for the password to secure the private key, you may either enter or leave it blank. This will generate a private key, id_rsa, and a public key,, in the .ssh directory of the local user's home directory.

Then copy your public key to the remote server.

a. Run the command to print your local machine's public key on the terminal

cat ~/.ssh/

b. Copy this public key to the clipboard. Connect to the remote server as a root user and switch to the new user that you created. Create '.ssh' directory, in the home directory of the new user and restrict its permission with following commands.

su - demo
mkdir .ssh
chmod 700 .ssh

c. Now open a new file in .ssh with name authorized_keys and paste the public key in the file and save.

nano .ssh/authorized_keys

d. Restrict the permissions of the authorized_keys file.

chmod 600 .ssh/authorized_keys

Now, you should be able to connect the remote server with the new user i.e. demo by running following command on your local machine.


Your comment