Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
pagespeed on;
# Needs to exist and be writable by nginx. Use tmpfs for best performance.
pagespeed FileCachePath /var/ngx_pagespeed_cache;
# Ensure requests for pagespeed optimized resources go to the pagespeed handler
# and no extraneous headers get set.
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
# Respecting Vary Headers
pagespeed RespectVary on;
# Honoring no-transform Cache-Control Headers
pagespeed DisableRewriteOnNoTransform off;
# Lower-casing HTML element and attribute names
pagespeed LowercaseHtmlNames on;
# Preserving HTML caching headers
pagespeed ModifyCachingHeaders off;
pagespeed EnableFilters combine_css,rewrite_css,rewrite_style_attributes,prioritize_critical_css,move_css_to_head,move_css_above_scripts;
pagespeed EnableFilters lazyload_images,inline_preview_images,convert_to_webp_lossless,resize_images,resize_mobile_images;
pagespeed EnableFilters collapse_whitespace,remove_quotes,insert_dns_prefetch;
pagespeed EnableFilters local_storage_cache;
# Preserve URL Relativity
pagespeed PreserveUrlRelativity on;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.