Skip to content

Instantly share code, notes, and snippets.

@pekkis
Created October 18, 2013 07:30
Show Gist options
  • Save pekkis/7037765 to your computer and use it in GitHub Desktop.
Save pekkis/7037765 to your computer and use it in GitHub Desktop.
Janimatin gistautusta... Janimatti tykkää gistauksesta.
# Default Gzip Configuration (Set Exceptions Per Location)
gzip on;
gzip_comp_level 1;
gzip_http_version 1.1;
gzip_vary On;
gzip_proxied any;
gzip_types text/plain text/css text/xml application/xml application/xml+rss application/xml+atom text/javascript application/x-javascript application/javascript application/json;
gzip_disable "MSIE [1-6]\.";
# 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|less|js|txt)$ {
access_log off;
expires 30d;
gzip on;
}
# 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