Skip to content

Instantly share code, notes, and snippets.

@VirtuBox
Created June 13, 2017 22:11
Show Gist options
  • Save VirtuBox/d5a8c4fb309fb7c7d98806396ecf8652 to your computer and use it in GitHub Desktop.
Save VirtuBox/d5a8c4fb309fb7c7d98806396ecf8652 to your computer and use it in GitHub Desktop.
Enable Gzip compression and allow browser cache for static files
# Enable Gzip compression
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/x-component
text/xml
text/javascript;
# Cache static files
location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|swf)$ {
add_header "Access-Control-Allow-Origin" "*";
access_log off;
log_not_found off;
expires max;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment