It's not hard, but it turns out there's a trick to it. I've run into this problem twice now, so I figure it should be documented. This is the solution if your "/" route is resulting in "Not Found" or an Apache directory listing.

You can read more about the problem at Ardekantur's "Phusion, Rack, Sinatra, and sub-domains", but here's my quick solution:

  1. Disable mod_autoindex if it is enabled.
  2. Make sure your RackBaseURI does not have a trailing slash.
  3. Add this before_filter to your Sinatra app:
    before do   request.env['PATH_INFO'] = '/' if request.env['PATH_INFO'].empty? end

I suppose an alternative solution would be feasible using Rack middleware, but this is what I'm using. Thanks to Ryan Funduk for helping me figure this stuff out.