
index index.php;

include 	global/wordpress_set_skip_cache.conf;

location / {
    # This is cool because no php is touched for static content.
    # include the "?$args" part so non-default permalinks doesn't break when using query string
    try_files $uri $uri/ /index.php?$args;
}

location /redis-fetch {
    internal  ;
    set  $redis_key $args;
    redis_pass  127.0.0.1:6379;
}

location /redis-store {
    internal  ;
    set_unescape_uri $key $arg_key ;
    redis2_query  set $key $echo_request_body;
    redis2_query expire $key 14400;
    redis2_pass  127.0.0.1:6379;
} 

location ~ \.php$ {
    try_files $uri = 404;
    fastcgi_hide_header X-Powered-By;

    set $key "blog-cache:$scheme$request_method$host$request_uri";
    srcache_fetch_skip $skip_cache;
    srcache_store_skip $skip_cache;
    srcache_response_cache_control off;
    set_escape_uri $escaped_key $key;
    srcache_fetch GET /redis-fetch $key;
    srcache_store PUT /redis-store key=$escaped_key;
    more_set_headers 'X-Cache $srcache_fetch_status';
    more_set_headers 'X-Cache-2 $srcache_store_status';

    include        fastcgi.conf;
    fastcgi_pass unix:/var/run/php-fpm_blog.sock;
}

# Directives to send expires headers and turn off 404 error logging.
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
    access_log off; 
    log_not_found off; 
    expires max;
}
