Skip to content

Instantly share code, notes, and snippets.

@agibralter
Created January 10, 2012 16:36
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 agibralter/1589915 to your computer and use it in GitHub Desktop.
Save agibralter/1589915 to your computer and use it in GitHub Desktop.
server {
listen 8000;
server_name foo.com;
root /mnt/foo/current/public;
# Allow all assets to be cached by CloudFront and browsers.
add_header Cache-Control public;
# Default expires of 1 hour.
expires 1h;
# Only set far-future expires for assets with hashes. Note: since max_expire
# contains curly brackets in the regexp, we must use quotes.
location ~* "-[0-9a-f]{32}\.(ico|css|js|gif|jpe?g|png|svg)(\.gz)?$" {
expires max;
}
location ~* "-[0-9a-f]{32}\.(eot|ttf|otf|woff)(\.gz)?$" {
add_header Access-Control-Allow-Origin *;
expires max;
}
location ~* "\.(eot|ttf|otf|woff)(\.gz)?$" {
add_header Access-Control-Allow-Origin *;
}
}
server {
listen 8000;
server_name foo.com;
root /mnt/foo/current/public;
# Allow all assets to be cached by CloudFront and browsers.
add_header Cache-Control public;
# Default expires of 1 hour.
expires 1h;
# Only set far-future expires for assets with hashes. Note: since max_expire
# contains curly brackets in the regexp, we must use quotes.
location ~* "-[0-9a-f]{32}\.(ico|css|js|gif|jpe?g|png|eot|ttf|otf|woff|svg)(\.gz)?$" {
expires max;
}
if ($filename ~* "\.(eot|ttf|otf|woff)$"){
add_header Access-Control-Allow-Origin *;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment