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.
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 Apache Passenger Module
Now install rails and passenger gem on your system. Execute below commands to install both gem command. Now install the passenger for the Apache on your system using the following command.
Step 3 – Validate Apache Passenger Module
The default passenger configuration file for Apache create at /etc/httpd/conf.d/passenger.conf. You can edit this file and check the settings like below. The default PassengerRuby option is set to /usr/bin/ruby. I have changed it to our custom ruby installed with rvm like below screenshot.
Now, validate the passenger installation and configuration with the following command.
Step 4 – Configure Apache VirtualHost
Let’s configure the VirtualHost in Apache configuration with the domain name. The example virtual host configuration will look like below.
Step 5 – Restart Apache Service
After adding above lines in Apache configuration, restart Apache service using the following command. Congratulation! you have configured Ruby on Rails Application with Apache.