How to set up Apache with Passenger (mod_rails) on Mac OS X?

I was recently awarded the popular question badge for this question, so I thought it was about time I posted the answer. I'll just post the relevant parts of my conf files.

So in /etc/apache2/httpd.conf I have the following:

LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-3.0.7
PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

Also make sure to uncomment the following line:

Include /etc/apache2/extra/httpd-vhosts.conf

Then in /etc/apache2/extra/httpd-vhosts.conf I have the following:

NameVirtualHost *:80

<VirtualHost *:80>
   ServerName example.dyndns.org
   DocumentRoot "/Users/Shared/rails/project/public"
   <Directory /Users/Shared/rails/project/public>
      AllowOverride all
      Options -MultiViews
      Order allow,deny
      Allow from all
   </Directory>
</VirtualHost>

After today I will not have access to this server. We don't use it anymore. Instead we use Heroku. So if it's not working for you, for some reason, or I've forgot some vital part of the configuration, I will not be able to help you. It may be outdated and I don't know if it works with newer versions of passenger. Also the server was using Mac OS X Snow Leopard, so it may not work with other versions of OS X. However, my guess is that it hasn't changed all that much and that most of this is still valid.

I also want another disclaimer. This may not be the safest configuration. I don't understand all the options, but it seems to be very allowing. I had a colleague help me with the configuration and this is simply the first version of the configuration that we got working. We did not care much about the security since it was only a dev server and not production.

If you have any suggestions on how to improve the configuration, please feel free to post those. Even though I will not have any use for those, others still might. After all, this is a popular question.


https://github.com/Fingertips/passengerpane

I would try downloading the Passenger Preference Pane and using that to set up your development environment. Otherwise, if you are really adventurous, try out http://pow.cx. I use Pow myself for my Rails development.

If you do go with Pow, I recommend the powder gem along with it for managing your Pow installation. It should be as simple as:

gem install powder

That should be all you need to do and then read up on powder here: https://github.com/Rodreegez/powder