Using Phusion Passenger in Facebook apps development

Ray pointed me to a RailsCast on how to use Passenger for local development, it literally took me 2 minutes to setup. If you work on multiple Ruby on Rails applications, you should definitely do it.

There is however one problem on this approach, since the default passenger.pref config relies on virtual host, you can’t really setup SSH port forward to forward something to one of the virtual hosts, and this is important as this is how most of us develop Facebook applications locally. To get Passenger and Rails Facebook apps to work, you have to:

  • open up httpd.conf ask Apache to listen to another port:
Listen 81
  • add another named virtual host, here I’m adding port *.81:
<IfModule passenger_module>
  NameVirtualHost *:80
  NameVirtualHost *:81
  Include /private/etc/apache2/passenger_pane_vhosts/*.conf
</IfModule>
  • In the configuration for that Facebook app, change it to respond to all traffic on the new port (81 in this case):
<VirtualHost *:81>
  ServerName app_name.local
  DocumentRoot "/Users/ayn/work/app_name/public"
  RailsEnv development
  RailsAllowModRewrite off
  <directory "/Users/ayn/work/app_name/public">
    Order allow,deny
    Allow from all
  </directory>
</VirtualHost>

Now you can setup your tunnel to forward to localhost (or 127.0.0.1 if you use SSHKeychain) port 81 and it should work. Add more ports if you work on multiple Facebook apps at the same time.

, , , , ,

No comments yet.

Leave a Reply