Problem with new Passenger Module and rewrite rules


#1

Hi,

I’ve got a problem, I’m trying to get the new nginx passenger module
(phusion.nl) to work with some rewrite rules.
The cache files for a multisite app (mephisto) are located in
/cache/domain.tld/

I want to rewrite the following:
/ -> /cache/example.com/index.html
/about/ -> /cache/example.com/about.html
/images/fu.jpg -> /cache/example.com/images/fu.jpg

my rules are basically as follows (inside the server block):

rewrite ^/$ /cache/$host/index.html break;
rewrite ^([^.]+?)/?$ /cache/$host$1.html break;

location ~ ^/(images|javascripts|stylesheets)/ {
if (!-e $request_filename) {
rewrite ^/(images|javascripts|stylesheets)/(.+)$
/cache/$host/$1/$2 last;
}
}

This works fine if the cached files exist, however, if they don’t in
which case the passenger module should forward the request
to the actual app, it doesn’t.
The app doesn’t get any request… and I don’t know why…

Can anyone tell me why this happens?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,1521,1521#msg-1521


#2

is this a passenger module specific problem?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,1521,1666#msg-1666


#3

solars wrote:

is this a passenger module specific problem?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,1521,1666#msg-1666

It seems this issue is with the Passenger module, they have the same
problem with Apache:
http://code.google.com/p/phusion-passenger/issues/detail?id=230


#4

Jan Faber wrote:

solars wrote:

is this a passenger module specific problem?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,1521,1666#msg-1666

It seems this issue is with the Passenger module, they have the same
problem with Apache:
http://code.google.com/p/phusion-passenger/issues/detail?id=230

No, that should be an entirely different issue.

In Nginx you need to redefine ‘passenger_enabled on’ in all location
blocks, otherwise Nginx will disable Phusion Passenger in that block.


#5

Hongli L. wrote:

Jan Faber wrote:
No, that should be an entirely different issue.

In Nginx you need to redefine ‘passenger_enabled on’ in all location
blocks, otherwise Nginx will disable Phusion Passenger in that block.

Thanks a lot for the quick reply (from the man himself no less :-).
Excuse my ignorance, I’m just getting started with Nginx. So far, I like
it, the conf syntax is a breath of fresh air after years of Apache. Docs
on the combi Nginx/REE are a little light compared to the extensive
Apache docs though.