#INFO=name=WordPress (FastCGI Cache)
set $skip_cache 0;

# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
    set $skip_cache 1;
}

if ($query_string != "") {
    set $skip_cache 1;
}

# Don't cache uris containing the following segments
if ($request_uri ~* "${template_location}wp-admin/|${template_location}xmlrpc.php|${template_location}wp-.*.php|${template_location}feed/|${template_location}index.php|${template_location}sitemap(_index)?.xml") {
    set $skip_cache 1;
}

# Don't use the cache for logged in users or recent commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
    set $skip_cache 1;
}

location ~ /purge(/.*) {
    fastcgi_cache_purge FASTCGICACHE "$scheme$request_method$host$1";
}

if (!-e $request_filename)
{
	rewrite ^(.+)$ ${template_location}index.php?q=$1 last;
}
