Created
February 20, 2013 10:51
-
-
Save pekkis/4994732 to your computer and use it in GitHub Desktop.
Cache settings for nginx
This file contains hidden or 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
# odp | |
location ~* ^.+\.(odt|odp)$ { | |
access_log off; | |
gzip off; | |
expires 30d; | |
} | |
# non-zipped images | |
location ~* ^.+\.(jpg|jpeg|gif|png|ico)$ { | |
access_log off; | |
gzip off; | |
expires 30d; | |
} | |
# gzipped images | |
location ~* ^.+\.(svg)$ { | |
access_log off; | |
gzip on; | |
expires 30d; | |
} | |
# Documents | |
location ~* ^.+\.(css|js|html|txt)$ { | |
access_log off; | |
expires 30d; | |
gzip on; | |
charset utf-8; | |
} | |
# Web fonts, gzipped | |
location ~* ^.+\.(eot|ttf|otf|woff)$ { | |
access_log off; | |
gzip on; | |
expires 30d; | |
add_header Access-Control-Allow-Origin *; | |
} | |
# archives | |
location ~* ^.+\.(pdf|gz|bz2|exe|rar|zip|7z)$ { | |
access_log off; | |
gzip off; | |
} | |
# videos | |
location ~* ^.+\.(mp4|avi)$ { | |
access_log off; | |
gzip off; | |
} | |
# bad regexes | |
location ~* (\.svn|\.git) { | |
access_log off; | |
deny all; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment