Skip to content

Commit

Permalink
Enable Gzip compression in NGINX (#997)
Browse files Browse the repository at this point in the history
* Enable Gzip compression in NGINX

* Merge branch 'master' into nginx-gzip
  • Loading branch information
johnthagen authored Feb 7, 2021
1 parent e55248e commit 465570e
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions nginx/templates/default.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,42 @@ server {
# Allow clients to import large projects.
client_max_body_size 250m;

# Gzip responses to decrease page loading time.
# https://www.digitalocean.com/community/tutorials/
# how-to-increase-pagespeed-score-by-changing-your-nginx-configuration-on-ubuntu-16-04
gzip on;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;

gzip_types
application/atom+xml
application/javascript
application/json
application/ld+json
application/manifest+json
application/rss+xml
application/vnd.geo+json
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/bmp
image/svg+xml
image/x-icon
text/cache-manifest
text/css
text/plain
text/vcard
text/vnd.rim.location.xloc
text/vtt
text/x-component
text/x-cross-domain-policy;
# text/html is always compressed by gzip module

location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
Expand Down

0 comments on commit 465570e

Please sign in to comment.