Skip to content

Instantly share code, notes, and snippets.

@KTamas
Created October 13, 2010 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KTamas/623974 to your computer and use it in GitHub Desktop.
Save KTamas/623974 to your computer and use it in GitHub Desktop.
server {
server_name blog.ktamas.com;
root /var/www/blog.ktamas.com;
include /etc/nginx/fastcgi_php;
location / {
gzip on;
gzip_http_version 1.0;
gzip_vary on;
gzip_comp_level 3;
gzip_proxied any;
gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_buffers 16 8k;
index index.php;
set $totalcache_file '';
set $totalcache_uri $request_uri;
if ($request_method = POST) {
set $totalcache_uri '';
}
# Using pretty permalinks, so bypass the cache for any query string
if ($query_string) {
set $totalcache_uri '';
}
if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_" ) {
set $totalcache_uri '';
}
# if we haven't bypassed the cache, specify our totalcache file
if ($totalcache_uri ~ ^(.+)$) {
set $totalcache_file /wp-content/w3tc-$http_host/pgcache/$1/_default_.html;
}
# only rewrite to the totalcache file if it actually exists
if (-f $document_root$totalcache_file) {
rewrite ^(.*)$ $totalcache_file break;
}
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php last;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment