Skip to content

Instantly share code, notes, and snippets.

@jhowbhz
Last active February 9, 2023 02:00
Show Gist options
  • Save jhowbhz/93c06ca401103e553379e3bd659e36b3 to your computer and use it in GitHub Desktop.
Save jhowbhz/93c06ca401103e553379e3bd659e36b3 to your computer and use it in GitHub Desktop.
SEO nginx to 80% Google Page Speed
# Thanks
# https://www.digitalocean.com/community/tutorials/how-to-increase-pagespeed-score-by-changing-your-nginx-configuration-on-ubuntu-16-04
server {
listen 80 default_server;
listen [::]:80 default_server;
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 ~* \.(jpg|jpeg|png|gif|ico|css|js|pdf)$ {
expires 7d;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment