Skip to content

Instantly share code, notes, and snippets.

@admench
Created July 31, 2017 10:13
Show Gist options
  • Save admench/98bbc722f7414aabd7dafbd494167ca6 to your computer and use it in GitHub Desktop.
Save admench/98bbc722f7414aabd7dafbd494167ca6 to your computer and use it in GitHub Desktop.
Forge Nginx cache settings
# cache.appcache, your document html and data
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
try_files $uri $uri/ /index.php?$args;
expires -1;
}
# Feed
location ~* \.(?:rss|atom)$ {
try_files $uri $uri/ /index.php?$args;
expires 1h;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff)$ {
try_files $uri /index.php?$query_string;
expires 7d;
add_header Pragma "public";
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
@admench
Copy link
Author

admench commented Jul 31, 2017

This uses the try_files method to work with Craft CMS or similar MVC type url generation. Without this line, the admin panel of Craft will not look correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment