Phusion Passenger with Apache on RHEL 6 / CentOS 6 / SL 6 with SELinux

A brief guide:

  1. Install ruby and passenger dependencies
    yum -y install ruby zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel
  2. Install gem
    tar zxvf rubygems-1.8.17.tgz
    cd rubygems-1.8.17
    ruby setup.rb
  3. Install and build a Passenger for Apache
    gem install passenger
  4. Create passenger.conf file in /etc/httpd/conf.d
    LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/apache2/
    PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11
    PassengerRuby /usr/bin/ruby
  5. Create conf file for your Rails application
  6. Temporarily go into SELinux permissive mode
    setenforce 0
  7. Restart Apache
    /sbin/service httpd restart
  8. Start using your Rails application
  9. Walk through SELinux log and generate new SELinux policy module
    grep httpd /var/log/audit/audit.log | audit2allow -M passenger
  10. Install newly created SELinux module
    semodule -i passenger.pp
  11. Switch SELinux back into enforcing mode
    setenforce 1

You may also like...

  • Stoyan Stoyanoff

    Thank you Sergiy,
    After 2 sleepless nights, I solve my problem in few minutes with your hints.
    My configuration is with rvm, but anyhow information in this page was very, very helpful

    Thank you very much again.

    Best regards,
    Stoyan Stoyanoff

    • Sergiy Kyrylkov

      I’m glad to hear.

  • Pingback: Deploying Rails apps on CentOS SELinux | Kude Labs()

  • Mark P

    Thanks! You just saved me a ton of time dealing with Passenger/SELinux issues.

  • Mohit Arora

    Thanks man. Worked like a charm.

  • Pingback: CSchmitt.Net » Phusion Passenger in CentOS()

  • ok -> Распространённые ошибки при настройке.

  • Josh

    This was a huge help in getting Apache + Passenger going, thank you so much!