Skip to content

Instantly share code, notes, and snippets.

@ncole458
Last active September 16, 2017 08:04
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 ncole458/6f079529dd6a7d687a0be37ec382aff7 to your computer and use it in GitHub Desktop.
Save ncole458/6f079529dd6a7d687a0be37ec382aff7 to your computer and use it in GitHub Desktop.
Enable gzip compression & add expires headers in nginx
# /etc/nginx/nginx.conf
##
# `gzip` Settings
#
#
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_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
# and in each site-available configs
location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff2)$ {
expires 30d;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment