Created
October 12, 2015 13:53
-
-
Save seanhandley/bf0f49b433469134371e to your computer and use it in GitHub Desktop.
NginX Cache Headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
# ... | |
# Feed | |
location ~* \.(?:rss|atom)$ { | |
expires 1h; | |
add_header Cache-Control "public"; | |
} | |
# Media: images, icons, video, audio, HTC | |
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { | |
expires 1M; | |
access_log off; | |
add_header Cache-Control "public"; | |
} | |
# CSS and Javascript | |
location ~* \.(?:css|js)$ { | |
expires 1y; | |
access_log off; | |
add_header Cache-Control "public"; | |
} | |
# ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment