Subscribe to our feed

Symfony Experts

Symfony Experts
If you have an urgent question for a symfony-related issue, this is the place to ask.


Stack Overflow

The old fashioned way


November 18, 2010 – 5:02pm Installing Phusion Passenger on WHM/cPanel

Login to your server and switch to root (yes, you need root access).

gem install passenger

export APXS2=/usr/local/apache/bin/apxs
export APR_CONFIG=/usr/local/apache/bin/apr-1-config


Here the installer (which is awesome and very user friendly) will tell you if you have all the required components, and if not, it will tell you what you need to do to install them.

I was missing Curl development headers with SSL support.

yum install curl-devel

once that finished, try again:


If you have all of the required components, passenger will compile and you’ll end up with an apache2 module. It tells us to update our apache configuration with these lines… don’t do it yet:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.0/ext/apache2/
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.0
PassengerRuby /usr/bin/ruby

As you may have discovered, WHM really does want to manage all of your apache configuration files for you, and thus if you start messing with them directly they will likely get overwritten the next time you update your server (i.e. with Apache EasyUpdate).

The correct way to add changes to your apache configuration is to add it to /usr/local/apache/conf/includes/pre_virtualhost_global.conf. It might not exist. (Mine had just a few lines we had put in there for PCI compliance, such as “ServerSignature Off”).

Once you have added those three lines to your pre_virtualhost_global.conf file, it’s time to restart apache.

/etc/rc.d/init.d/httpd restart

Magically, apache restarted without any errors. If you run into any trouble, go back and comment out the lines in your conf file above and try to restart the service again. If you need help looking at logs, restarting services, etc, check out the WHM docs.

Finally, passenger tells us this:

Deploying a Ruby on Rails application: an example

Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:

DocumentRoot /somewhere/public # <-- be sure to point to 'public'!
AllowOverride all # <-- relax Apache security settings Options -MultiViews # <-- MultiViews must be turned off

So, how do you add custom directives to your accounts in WHM? Check out the documentation on custom VirtualHost directives.

More information:

Posted by in  Web Development   |  

3 Responses to Installing Phusion Passenger on WHM/cPanel

  1. Joshua says:

    Thanks for the tutorial. I wasn’t able to restart Apache but started over with your tutorial here and I was able to get it restarted after Passenger install.

    Now it’s time to figure out where to configure the Rails apps virtual hosts.

    Joshua Needham

  2. Carlos Roque says:

    why do i need this?
    export APXS2=/usr/local/apache/bin/apxs
    export APR_CONFIG=/usr/local/apache/bin/apr-1-config

    when i was installing passenger it found other apache setups

  3. Scott Meves says:

    @carlos, if your Apache installation’s location is non-standard then you need to help the installer find those binaries… the ENV vars may not be required if the installer doesn’t complain.