Welcome! Log In Create A New Profile

Advanced

try_files based on file mtime?

June 12, 2010 12:19AM
Hi all,

I found nginx a little while ago and I've been working on a fast wordpress setup with it. One thing I'm having a problem with is serving cached pages with an expiration.

So I have this (simplified a bit):

location / {
# If it's a real static file just serve it, otherwise check the cache
try_files $uri $uri/ @checksupercache;
}

location @checksupercache {
# First check if user is logged in, etc, but let's assume not, so we want to serve the static cache if it exists
# This is the point where I would like to check the file's mtime. If it's too old, use @gotoblog even though the file exists.
try_files /wp-content/cache/supercache/$http_host/$uri/index.html @gotoblog;
}

How do I implement that last part? Say I want cached pages to last 2 minutes. Something like this would be perfect:
try_files 2m blah/blah/$uri @otherwise;

What's the best way to do this?

If there's not a great way right now, would this be better/easier for me to implement as a patch to try_files or as a separate module with a separate command?

Thanks!
SubjectAuthorPosted

try_files based on file mtime?

stdragonJune 12, 2010 12:19AM

Re: try_files based on file mtime?

Igor SysoevJune 12, 2010 03:52AM

Re: try_files based on file mtime?

stdragonJune 12, 2010 10:22AM

Re: try_files based on file mtime?

Manlio PerilloJune 13, 2010 01:26PM

Re: try_files based on file mtime?

wayanSeptember 14, 2012 05:15AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 66
Record Number of Users: 4 on November 24, 2014
Record Number of Guests: 377 on November 23, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready