configure apache passenger problem

2,155 views
Skip to first unread message

Hai Tao

unread,
Jul 7, 2012, 2:23:29 PM7/7/12
to puppet...@googlegroups.com
I am configuring apache passenger by following the doc
http://projects.reductivelabs.com/projects/puppet/wiki/Using_Passenger

I am getting following erros when start httpd:

]# /etc/init.d/httpd start
Starting httpd: httpd: Syntax error on line 221 of
/etc/httpd/conf/httpd.conf: Syntax error on line 5 of
/etc/httpd/conf.d/10_passenger.conf: Cannot load
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.12/ext/apache2/mod_passenger.c
into server: /usr/lib/ruby/gems/1.8/gems/passenger-3.0.12/ext/apache2/mod_passenger.c:
invalid ELF header
[FAILED]

the /usr/lib/ruby/gems/1.8/gems/passenger-3.0.12/ext/apache2/mod_passenger.c
is the only thing I found in my system, I cannot find a
mod_passenger.so file.

here is my config, please help:
===========================================================
# ll
total 28
-rw-r--r-- 1 root root 861 Jul 7 11:08 10_passenger.conf
-rw-r--r-- 1 root root 1299 Jul 7 10:57 rack.conf
-rw-r--r-- 1 root root 392 Dec 8 2011 README
-rw-r--r-- 1 root root 9473 Dec 8 2009 ssl.conf
-rw-r--r-- 1 root root 299 May 20 2009 welcome.conf

==============================================================
# cat 10_passenger.conf

# /etc/httpd/conf.d/10_passenger.conf

# The passenger module path should match ruby gem version
# LoadModule passenger_module
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
LoadModule passenger_module
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.12/ext/apache2/mod_passenger.c
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.12
PassengerRuby /usr/bin/ruby

# Recommended Passenger Configuration
PassengerHighPerformance on
PassengerUseGlobalQueue on
# PassengerMaxPoolSize control number of application instances,
# typically 1.5x the number of processor cores.
PassengerMaxPoolSize 6
# Restart ruby process after handling specific number of request to
resolve MRI memory leak.
PassengerMaxRequests 4000
# Shutdown idle Passenger instances after 30 min.
PassengerPoolIdleTime 1800
# End of /etc/httpd/conf.d/10_passenger.conf

=====================================================================
# cat rack.conf

# you probably want to tune these settings
PassengerHighPerformance on
PassengerMaxPoolSize 12
PassengerPoolIdleTime 1500
# PassengerMaxRequests 1000
PassengerStatThrottleRate 120
RackAutoDetect Off
RailsAutoDetect Off

Listen 8140

<VirtualHost *:8140>
SSLEngine on
SSLProtocol -ALL +SSLv3 +TLSv1
SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP

SSLCertificateFile
/var/lib/puppet/ssl/certs/hqd-puppet-01.telenav.com.pem
SSLCertificateKeyFile
/var/lib/puppet/ssl/private_keys/hqd-puppet-01.telenav.com.pem
SSLCertificateChainFile /var/lib/puppet/ssl/certs/ca.pem
SSLCACertificateFile /var/lib/puppet/ssl/ca/ca_crt.pem
# If Apache complains about invalid signatures on the CRL, you
can try disabling
# CRL checking by commenting the next line, but this is not recommended.
SSLCARevocationFile /var/lib/puppet/ssl/ca/ca_crl.pem
SSLVerifyClient optional
SSLVerifyDepth 1
SSLOptions +StdEnvVars

DocumentRoot /etc/puppet/rack/public/
RackBaseURI /
<Directory /etc/puppet/rack/>
Options None
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>


--
Hai Tao

myeazel

unread,
Jul 8, 2012, 12:53:20 PM7/8/12
to puppet...@googlegroups.com
When I was just setting up passenger, I had to alter that line referencing mod_passenger.so to our apache modules directory.

# LoadModule passenger_module 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so 

This needed to be changed to /etc/httpd/modules/mod_passenger.so since that is where apache has the module for passenger. I think you just need to track down where that module is and point the configuration to the right place.

earthgecko

unread,
Jul 8, 2012, 1:45:59 PM7/8/12
to puppet...@googlegroups.com
Sound like you only have the passenger gem installed, it needs to install the apache module.  Here is a snippet from a Centos puppet build.

####    init.pp    ####
#
# modules/passenger/manifests/init.pp
class passenger {

  package { 'rack':
    ensure   => '1.1.0',
    provider => 'gem',
    require  => Class['rubygems'],
    before   => Package['passenger'],
  }

  package { 'passenger':
    ensure   => installed,
    provider => 'gem',
    require  => Package['rack'],
    before   => File['/opt/passenger'],
  }

  ####
  # auto install passenger apache2 module and create links
  file { '/opt/passenger':
    ensure => 'directory',
    owner  => 'root',
    group  => 'root',
    mode   => '0755',
    before => File['/opt/passenger/auto_passenger_install.sh'],
  }

  file { '/opt/passenger/auto_passenger_install.sh':
    ensure => 'present',
    owner  => 'root',
    group  => 'root',
    mode   => '0755',
      source => 'puppet:///modules/passenger/auto_passenger_install.sh',
    before => Exec['auto_passenger_install'],
  }

  exec { 'auto_passenger_install':
    command => '/opt/passenger/auto_passenger_install.sh',
    timeout => '900',
    creates => '/etc/passenger',
  }
}

The install script.  This installs the mod_passenger.so and links the directory to /etc/passenger (which means easy to upgrade version, the link is just swapped - apache still needs to restart as it reads the hardlink when started.)

#!/bin/bash
####   auto_passenger_install.sh   ####
#
# modules/passenger/files/auto_passenger_install.sh
#########
# Script variables
SCRIPT=$(readlink -f $0)
SCRIPTNAME=$(basename "$SCRIPT")
SCRIPTPATH=$(dirname $SCRIPT)
SERVER=`hostname | cut -d'.' -f1-1`
TIMESTAMP=$(date +%s)
RUNDATE=`date -d @$TIMESTAMP +%Y%m%d%H%M%S`
LOG_PATH=/var/log/scripts/$SCRIPTNAME
if [ ! -d $LOG_PATH ]; then
  mkdir -p $LOG_PATH
fi
LOGFILE=$LOG_PATH/$RUNDATE.$SCRIPTNAME.log

RUBYGEMS_VER_DIR=$(basename `facter rubysitedir`)
PASSENGER_VERSION=`gem list --local | grep passenger | sed -e 's/passenger (//g;s/)//g'`
cd /usr/lib/ruby/gems/$RUBYGEMS_VER_DIR/gems/passenger-$PASSENGER_VERSION
/usr/bin/ruby /usr/bin/rake apache2:clean apache2 RELEASE=yes

ln -s /usr/lib/ruby/gems/$RUBYGEMS_VER_DIR/gems/passenger-$PASSENGER_VERSION /etc/passenger

Reply all
Reply to author
Forward
0 new messages