Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Programming»Ruby»How to Deploy Ruby Application with Passenger and Apache on CentOS 7/6, Fedora 27

    How to Deploy Ruby Application with Passenger and Apache on CentOS 7/6, Fedora 27

    RahulBy RahulOctober 17, 20172 Mins ReadUpdated:October 31, 2017

    Phusion Passenger is an application server which can be integrated into web server like Apache web servers and allows to serve Ruby/Rails applications via the web server. It’s a good option to deploy Ruby on Rails application on productions systems. This article will help you to deploy Ruby application with Apache on CentOS, Red Hat and Fedora systems. You can use this tutorial for staging as well as production deployments.

    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.

    $ sudo yum install -y epel-release yum-utils
    $ sudo yum-config-manager --enable epel
    $ sudo yum clean all && sudo yum update -y
    

    Step 2 – Install Apache Passenger Module

    Now install rails and passenger gem on your system. Execute below commands to install both gem command.

    $ sudo yum install -y pygpgme curl
    
    $ sudo curl --fail -sSLo /etc/yum.repos.d/passenger.repo https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo
    

    Now install the passenger for the Apache on your system using the following command.

    $ sudo yum-config-manager --enable cr && sudo yum install -y mod_passenge
    

    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.

    $ vim /etc/httpd/conf.d/passenger.conf
    

    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.

    $ sudo /usr/bin/passenger-config validate-install
    

    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.

    <VirtualHost *:80>
        ServerName example.com
    
        # Path to Ruby Application's 'public' directory
        DocumentRoot /path-to-your-app/public
    
        <Directory /path-to-your-app/public>
    	  Allow from all
    	  Options -MultiViews
    	  # Uncomment this if you're on Apache > 2.4:
    	  #Require all granted
        
        </Directory>
    </VirtualHost>
    

    Step 5 – Restart Apache Service

    After adding above lines in Apache configuration, restart Apache service using the following command.

    $ sudo systemctl restart httpd.service
    

    Congratulation! you have configured Ruby on Rails Application with Apache.

    passenger passenger-install-apache2-module ror application setup with apache ROR with Apache Setup ROR app with Apache
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow To Install Skype on Ubuntu 18.04
    Next Article Reset SugarCRM Admin Password via SQL or phpMyAdmin

    Related Posts

    How to Install Ruby on Ubuntu 20.04

    Updated:July 27, 20204 Mins Read

    How to Install Ruby on CentOS/RHEL 8 and Scientific Linux

    Updated:April 3, 20203 Mins Read

    How to Install Ruby on Debian with RVM

    Updated:November 10, 20204 Mins Read

    How to Deploy Ruby App with Nginx and Passenger on Ubuntu and Debian

    Updated:November 1, 20173 Mins Read

    How to Deploy Ruby App with Apache and Passenger on Ubuntu and Debian

    Updated:October 31, 20173 Mins Read

    How to Install Ruby on CentOS/RHEL 7/6

    Updated:April 3, 20203 Mins Read

    2 Comments

    1. Jo on February 6, 2014 5:21 pm

      Hi Rahul

      I followed your instructions to configure the Ruby on Rails Application with Apache using Phusion Passenger. Your instructions looks to be very specific to the point.

      However, I encountered some errors while restarting the httpd services. Running the command # passenger-install-apache2-module asked me to add the following lines to the httpd.conf file.

      ” LoadModule passenger_module /usr/local/rvm/gems/ruby-2.1.0/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so

      PassengerRoot /usr/local/rvm/gems/ruby-2.1.0/gems/passenger-4.0.37
      PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.1.0/wrappers/ruby
      ”

      I added the above lines into the httpd.conf files’ module session(before the ).

      I then issued the command to restart the httpd and am getting the following error message. I am new to Ruby on Rail and also Linux. Trying to setup an application with Ruby on Rails. Could you please advise me what is wrong here?

      “[[email protected] ~]# service httpd restart
      Stopping httpd: [FAILED]
      Starting httpd: httpd: Syntax error on line 969 of /etc/httpd/conf/httpd.conf: Cannot load /usr/local/rvm/gems/ruby-2.1.0/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so into server: /usr/local/rvm/gems/ruby-2.1.0/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so: failed to map segment from shared object: Permission denied
      [FAILED]”

      Looking forward for your answer.

      Regards
      Jo

      Reply
    2. demarcus on June 4, 2013 5:44 pm

      Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You definitely know what youre talking about, why throw away your intelligence on just posting videos to your weblog when you could be giving us something enlightening to read?

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • What is CPU? – Definition, Types and Parts
    • What is the /etc/aliases file
    • What is the /etc/nsswitch.conf file in Linux
    • How to Install Ionic Framework on Ubuntu 22.04
    • What is the /etc/hosts file in Linux
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.