Skip to content

Instantly share code, notes, and snippets.

@yungke
Last active August 29, 2015 14:19
Show Gist options
  • Save yungke/77810e16626ac9be6c11 to your computer and use it in GitHub Desktop.
Save yungke/77810e16626ac9be6c11 to your computer and use it in GitHub Desktop.
ngx_pagespeed config 基本 / 進階設置
#ngx_pagespeed config
# enable CoreFilters
pagespeed RewriteLevel CoreFilters;
pagespeed FileCachePath /var/ngx_pagespeed_cache;
# disable particular filter(s) in CoreFilters
pagespeed DisableFilters rewrite_images;
# enable additional filter(s) selectively
pagespeed EnableFilters collapse_whitespace;
pagespeed EnableFilters lazyload_images;
pagespeed EnableFilters insert_dns_prefetch;
pagespeed MapOriginDomain "http://localhost" "https://yourdomain.com";
#ngx_pagespeed config
# disable CoreFilters
pagespeed RewriteLevel PassThrough;
pagespeed FileCachePath /var/ngx_pagespeed_cache;
# enable collapse whitespace filter
pagespeed EnableFilters collapse_whitespace;
# enable JavaScript library offload
pagespeed EnableFilters canonicalize_javascript_libraries;
# combine multiple CSS files into one
pagespeed EnableFilters combine_css;
# combine multiple JavaScript files into one
pagespeed EnableFilters combine_javascript;
# remove tags with default attributes
pagespeed EnableFilters elide_attributes;
# improve resource cacheability
pagespeed EnableFilters extend_cache;
# flatten CSS files by replacing @import with the imported file
pagespeed EnableFilters flatten_css_imports;
pagespeed CssFlattenMaxBytes 5120;
# defer the loading of images which are not visible to the client
pagespeed EnableFilters lazyload_images;
# enable JavaScript minification
pagespeed EnableFilters rewrite_javascript;
# enable image optimization
pagespeed EnableFilters rewrite_images;
# pre-solve DNS lookup
pagespeed EnableFilters insert_dns_prefetch;
# rewrite CSS to load page-rendering CSS rules first.
pagespeed EnableFilters prioritize_critical_css;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment