building passenger with macports in os x leopard and hosting with apache and create an alias with railsbaseuri

Jan 11 2009 Published by aaron under Apple, Programming, Sysadmin

Installing Passenger should be very easy. Please try following my steps below and you should get some good success. I built and used the following configuration with Mac OSX 10.6. But I am sure changes in the OS/Passenger/Ruby will change in the future. You will need to have the following for this article:

  1. MacPorts installed
  2. No fear of using the terminal

Below are the steps necessary to do everything, after that is a list of commands I used that follow the steps:

  1. Install the Passenger gem
  2. Install the Apache2 with MacPorts
  3. Set variable APXS for building passenger module
  4. Run build and install for Passenger module for Apache 2
  5. Edit Apache Conf file

Here is what I typed in (I have also attached Instructions on how to install Passenger and host Ruby on Rails with either Virtualhost or RailsBaseURI for downloading):

  1. gem install passenger
  2. port install apache2
  3. export APXS=/opt/local/apache2/bin/apxs
  4. passenger-install-apache2-module
  5. edit your apache conf file to add the following lines
    1. LoadModule passenger_module /opt/local/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so
    2. PassengerRoot /opt/local/lib/ruby/gems/1.8/gems/passenger-2.0.6
    3. PassengerRuby /opt/local/bin/ruby
  6. host your rails app with either a virtual host or RailsBaseURI /path/to/app/dir
    1. virtual host
      1. text to put in your apache conf
        1. <VirtualHost *:80>
        2. ServerName www.yourhost.com
        3. DocumentRoot /somewhere/public
        4. </VirtualHost>
    2. alias with railsbaseuri
      1. cd /somewhere/already
      2. ln -s /rails_app/public /new_app
      3. text to put in your apache conf
        1. <VirtualHost *:80>
        2. ServerName www.yourhost.com
        3. DocumentRoot /somewhere/already
        4. RailsBaseURI /new_app
        5. </VirtualHost>

No responses yet

Leave a Reply