Today I thought I give it a try.
I installed the gem an started passenger-install-apache2-module.
Currently I am running apache2 with mod_proxy -> haproxy -> mongrels. A standard setup I think.
After the installer finished I just commented out the two ProxyPass directives (the DocumentRoot was already set, because apache is serving static files anyway)
# ProxyPass / http://127.0.0.1:8000/ # ProxyPassReverse / http://127.0.0.1:8000/
I reloaded apache, stopped the mongrels, went to the application url and got a listing of the files in my public folder… uhm, that’s not what I was expecting :)
A bit of poking around and I discovered that a reload was of course not sufficient, but a restart was needed… duh. Stupid me. I restarted apache this time, went to the application url and see there: diffuse.it in all it’s glory. Almost. The images where not displayed. On diffuse.it you can protect your images with a password or show them only to your friends, so they are not served directly by apache, but they are processed by rails first, and then served by apache using the xsendfile header. I had to go to the passenger user guide but there was not really a solution…
“Static assets are accelerated, i.e. they are served directly by Apache and do not go through the Rails stack. There are two reasons why Apache doesn’t serve static assets correctly…”
those images are not “static assets”, I need those urls to go through the application first, and after the app made sure the user viewing them can really view them, serve them (or not).
Well, I have to search a bit more, or maybe mod_rails just can’t do this. I will update this post when I find out.
Update: It was a permission problem. Now the images work, and xsendfile works too. Cool. For some reason the application now was not running as apache2 user, but as the user owning the rails application (?). Well, the migration was a piece of cake. I’ll test it a bit more this days and post back.