The gem install - First I did the standard gem install.
sudo gem install passenger
Apache setup - Then do the passenger apache installation, which compiles the module, and has details about the exact content you need to insert into httpd.conf
httpd.conf setup - The passenger-install-apache2-module dumps a few lines to the console that need to be included in httpd.conf. Edit /etc/apache2/httpd.conf (
sudo vim /etc/apache2/httpd.conf). I put the inserted lines near line #117 in my httpd.conf, after the rest of the modules are defined.
LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-2.0.3 PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Use the preference pane to setup an app - For testing purposes, I just used a rails app. I wanted to be sure Passenger was working correctly before going after Rack apps. Very quickly, I ran into an issue. This line was in
[Fri Aug 15 21:23:11 2008] [notice] child pid 48688 exit signal Abort trap (6) terminate called after throwing an instance of 'Passenger::FileSystemException' what(): Cannot stat '/Users/cschneid/Documents/Programming/Rails/BashFight/public/../config/environment.rb': Permission denied (13) [Fri Aug 15 21:38:17 2008] [error] [client 127.0.0.1] (13)Permission denied: access to / denied
The solution to the permissions - It turns out that there is another step that is only mentioned in a single mailing list post. Apache needs another entry allowing itself access to the files. This is different and distinct from the filesystem permissions, which confused me for a while while trying to diagnose this.
order allow,deny Allow from all
Not quite - filesystem permissions matter too! After finding mention of the apache user directory details, I thought I had it fixed. BUT… not quite. It turns out that Apache needs file system permissions all the way up and down the file system tree. As you can see above, I keep all my code in /Users/cschneid/Documents/Programming/…. What turned out to be the final problem I faced was that /Users/cschneid had a permissions of 700. Apache was giving up because of that. A quick
chmod 755 /Users/cschneid fixed that problem. Just know that you need to check permissions on every directory in the path to your app.
The Sinatra App - Works exactly as you’d expect. Go see my various posts on deploying to a Passenger install (Another try w/ logging), (Deploying to Dreamhost) to see how to setup your config.ru file.