Skip to content

Instantly share code, notes, and snippets.

@takien
Created August 18, 2025 03:24
Show Gist options
  • Save takien/825714ad9c380dbe925a8677579f25f0 to your computer and use it in GitHub Desktop.
Save takien/825714ad9c380dbe925a8677579f25f0 to your computer and use it in GitHub Desktop.
# ...
#comet cache config, exclude wp-admin
location ~ ^/(?!(wp-admin)) {
etag on;
expires 7d;
if_modified_since before;
gzip on;
gzip_vary on;
gzip_comp_level 6;
gzip_types text/plain text/xml image/svg+xml # text/html in core already.
application/rss+xml application/atom+xml application/xhtml+xml
text/css application/json application/x-javascript
application/font-otf application/font-ttf;
try_files $uri $uri/ /index.php?$args;
}
# Do not allow public access to private cache directory.
if ($uri ~* /wp\-content/cache/comet\-cache/cache(?:/|$)) {
return 403;
}
# Do not allow public access to private cache directory.
if ($uri ~* /wp\-content/cache/comet\-cache/htmlc/private(?:/|$)) {
return 403;
}
# ↓ See: http://davidwalsh.name/cdn-fonts
# This prevents cross-domain security issues related to fonts.
# Only needed if you use Static CDN Filters in Comet Cache.
location ~* \.(?:ttf|ttc|otf|eot|woff|woff2|css|js)$ {
add_header Access-Control-Allow-Origin *;
}
# ↓ This is optional, but suggested. It's a flag to tell Comet Cache
# that you completed this Nginx configuration.
location ~* \.php$ {
fastcgi_param WP_NGINX_CONFIG done;
}
location ~ /\.ht {
deny all;
}
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment