Skip to content

Instantly share code, notes, and snippets.

@NoobTW
Created February 26, 2017 11:03
Show Gist options
  • Select an option

  • Save NoobTW/dc792db77eaf749751d24721ec8bdad1 to your computer and use it in GitHub Desktop.

Select an option

Save NoobTW/dc792db77eaf749751d24721ec8bdad1 to your computer and use it in GitHub Desktop.
Nginx WordPress Configuration
set $cache_uri $request_uri;
if ($request_method = POST) {
set $cache_uri 'null cache';
}
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.$
set $cache_uri 'null cache';
}
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
set $cache_uri 'null cache';
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; }
location / {
index index.htm index.html index.php;
try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?$query_string;
}
location ~ /(\.|wp-config.php|readme.html|license.txt) {
deny all;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment