First of all, we assume you already have Ruby installed on your system. If you do not have Ruby installed on your system, Use one of below URL to install it as per your application requirements.

How to Install Latest Ruby on Debian, Ubuntu, Linuxmint

Step 1 – Prerequisites

First of all, enable the HTTPS support for Apt repositories and install the PGP keys for passenger packages on your system. Then, add the passenger repository reference to below file. The lsb_release -cs will set the codename of your operating system. You can also change this and set the codename manually.

Step 2 – Install Passenger Nginx Module

Now install the passenger module and Nginx on your system. If you already have Nginx installed, this will installed latest Nginx packages from the passenger repository, which is compiled with passenger libraries. Edit Nginx configuration file /etc/nginx/nginx.conf and uncomment the include /etc/nginx/passenger.conf; line. For example see the below screenshot.

Step 3 – Create Nginx VirtualHost

Now, you can deploy your Ruby/Rails application on this server. Create a Nginx configuration file and configure the virtual host like the blow. Change the document root as per your application location on disk.

Step 4 – Verify Setting and Restart Nginx

Execute the below command to validate the passenger installation on your system. All checks should be passed properly. If any of check failed, it will help you to fix. Finally, reboot the Nginx web server to reload any changes made to its configuration files.

Deploy Ruby App with Nginx and Passenger on Ubuntu and Debian - 50