Using Passenger on OS X for Rails development
Lately a few things have been bugging me about Rails development using script/server. First, I can’t test through SSL and for applications who switch between SSL and non-SSL you really want your development environment too look as much like production as possible. And secondly, I have to manually manage my app server with script/server. This is a bit of a pain because some of our applications use ActiveResource to communicate so I need to start several app processes.
Proxying trough Apache solved the SSL problem, but now I had to remember on which ports I had to start my app server.
The solution turned out to be Passenger. First we install the passenger gem and compile mod_passenger.so.
After that we turn on Apache at System Preferences ➔ Sharing ➔ Web Sharing and edit the webserver configuration. I added everything to /etc/apache2/users/manfred.conf but Apache doesn’t really care where you put it, just remember to load mod_passenger.so before using Passenger specific configuration options.
Set up the Passenger configuration as explained at the end of the install script.
Make sure our apps run in development mode.
Allow Apache serve files from our development directories.
Finally, configure virtual hosts for our various projects.