Skip to content

Instantly share code, notes, and snippets.

@mkdizajn
Created January 30, 2021 22:34
Show Gist options
  • Save mkdizajn/506eab5938fdffdc77ab3473de9d8918 to your computer and use it in GitHub Desktop.
Save mkdizajn/506eab5938fdffdc77ab3473de9d8918 to your computer and use it in GitHub Desktop.
nginx cache
#CACHE
set $condition '';
if ($request_method = POST){
set $condition "null";
}
if ($query_string) {
set $condition "null";
}
if ($http_cookie ~* (comment_author|comment_author_|wordpress_logged_in|wp_woocommerce_session)) {
set $condition "null";
}
set $fullurl '/wp-content/cache/all${condition}';
#CACHE ENDING
location / {
set $serve_URL $fullurl${uri}index.html;
add_header mk-cache-loc $serve_URL;
try_files $serve_URL $uri $uri/ /index.php$is_args$args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment