Serving static versions of dynamic pages (non-RoR)

Ian M. Evans ianevans at digitalhit.com
Thu Aug 7 19:02:09 MSD 2008


Jean-Philippe wrote:
>     if (-f $request_filename.html)
>     {
>       rewrite ^(.*)$ $1.html break;
>     }

Okay, thanks.

> 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).
 > Maybe an if block like this :
 >
 > if ($request_filename ~ (foo)/(bar)/(baz)) {

Yeh, I figured the second part of the wish list would be the nutty one. 
It's too bad there's not a way (unless there is and I have to read 
deeper!) to string replace the pathinfo so you could just test something 
like:

location /galleries {
if ($request_filename.underscoredpathinfo.html) {...etc...

I guess I may have to consider something like Varnish, though I've read 
that nginx's ability to serve up static files can sometimes even be 
faster than memory caches due to filesystem caching.
}





More information about the nginx mailing list