[Home] You are not logged in. Login here

Just my stuff

passenger: mod_rails - first try

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.

Anonymous Micha said...

for me, passenger worked out-of-the-box.

the user your rails app is running as (when using passenger) is always the user owning the directory. this is great for shared hosting scenarios and is written in the documentation, too :)

Fri Apr 18 09:42:28 +0200 2008
Anonymous Luke Noel-Storr said...

I remember reading that the application is run as the owner of the rails directory for security in shared hosting environments.

Fri Apr 18 09:49:19 +0200 2008
 
Comments for this post have been disabled