First of all, we assume you already have Ruby installed on your system. If you do not have Ruby installed, use below URL to install it as per your application requirements.
Install Ruby on CentOS, RedHat, Fedora
Step 1 – Install Prerequisites
First of all, enable epel yum repository and update packages on your system.
Step 2 – Install Nginx Passenger Module
Now install rails and passenger gem on your system. Execute below commands to install both gem command. Now install the passenger on your system using the following command. Also, install or update Nginx on your system.
Step 3 – Enable Nginx Passenger Module
At this time you have installed Passenger and Apache server on your system. Now execute below command to install the passenger module for Apache. This command will show you the guided installation and tell you for any missing dependencies to install. The default passenger_ruby will be set up for the /usr/bin/ruby. I have changed the binary path to our custom installed Ruby version using RVM.
Step 4 – Configure Nginx VirtualHost
Let’s configure the VirtualHost in Nginx configuration file with the domain name. The example virtual host configuration will look like below.
Step 5 – Restart Nginx Service
After adding above lines in Apache configuration, restart Apache service using the following command. Congratulation! you have configured Ruby on Rails Application with Nginx.