Serving static versions of dynamic pages (non-RoR)

Jean-Philippe Moal skateinmars at skateinmars.net
Sat Aug 9 16:54:35 MSD 2008


Ian M. Evans a écrit :
> Jean-Philippe wrote:
>> Seems tricky if you want to test the cache existence and not simply 
>> rewrite to the underscored version (which could be done with a simple 
>> rewrite).
> 
> Right...is it correct to say that nginx can't regex replace BEFORE a 
> file test? That is, the logic can say:
> 
> if the request is in location /galleries rewrite and serve up 
> /galleries[path slashes converted to underscores].html
> 
>  but it can't say:
> if the request is in location /galleries rewrite the URI to 
> /galleries[path slashes converted to underscores].html, check to see if 
> that exists and if so, serve it up?
> 
I don't think the location directive sets $n ($1, $2 etc...) variables like the 
"if" directive, so the only way to do this may be using the perl module.

Otherwise you could still create your cache files using the same layout as your 
URLs (by creating multiples directories and subdirectories).





More information about the nginx mailing list