The Mongrel Web server can run with a URL prefix, using the —prefix option. This is useful for running an app in a “subdirectory”—say BankDirectr at http://banks.info/directr and BankRobbr at http://banks.info/robbr .

In development you want that same prefix; this way your stylesheets, images, and other static assets show correctly at the right URL. For this we had originally modified script/server to always pass —prefix to Mongrel.
Switching to Phusion Passenger has removed one tab from my screen session, and made development faster and easier. However, getting it to work with a subdirectory took a few minutes.
The basic idea is that Apache handles the static assets, and Passenger handles the rest. So in your VirtualHost block you need to add an Alias from the prefix to the DocumentRoot. Like this:
<VirtualHost *:80>
ServerName banks.info
DocumentRoot /var/www/robbr
Alias /robbr /var/www/robbr
</VirtualHost>
However, in an attempt to ruin our fun, Phusion Passenger’s documentation says this:
Phusion Passenger conflicts withmod_rewriteandmod_alias. Those modules may be installed and loaded together with mod_passenger, and they will work fine outside virtual hosts that contain a Rails application, but we recommend you not to use their features inside virtual hosts that contain a Rails application.
Fine. It works just fine for me using mod_alias, but that’s only in my development environment and not in production. Here’s another solution:
cd /var/www/robbr/public
ln -s . robbr
Now any asset that references /robbr , such as /robbr/stylesheets/layout.css , will follow the symlink to public .
I was having a lot of problems with getting ps2pdf working from a CGI Perl program running under Apache on Windows at a client’s site. If you’ve been paying attention you might ask “Why are you running Apache on Windows and Perl?”. That’d be a good question. The answer is because this stuff was written before we made that switch, and also necessity and compromise… definitely a topic for a future post.
Anyway, ps2pdf would work from the commandline, but from the Perl script the batch file that ps2pdf calls (ps2pdfxx) was not being found. Despite my Google kung-fu, it took me a while to find what looked like the solution.
Excited, I did what it said, but it still didn’t work! After trying everything else I could think of, I tried the old trick for Windows – rebooting… Turns out, environment variables don’t take effect for Apache on Windows unless you restart the computer, even restarting the Apache service doesn’t work.
I figure I better post it here for posterity, although hopefully you’re not actively deploying code running under Apache on Windows.