Optimal PageSpeed Configuration

By 15th July 2014May 17th, 2018No Comments

Table of Contents

  1. Dynamic Content

We know there can be some confusion in the most optimal settings for a store running Pagespeed, below you'll find configurations (continually updated) to reflect the most optimal configuration.

Dynamic Content

Create___general/, and replace the following to suit your stack,

  • lb1.i
# Enable PageSpeed
pagespeed on;
pagespeed Domain *;

pagespeed DownstreamCachePurgeLocationPrefix https://lb1.i;
pagespeed DownstreamCachePurgeMethod PURGE;
pagespeed DownstreamCacheRewrittenPercentageThreshold 95;

# PageSpeed should be disabled on the Magento admin  (adjust to suit custom admin URLs)
pagespeed Disallow "*/admin/*";
# Use the MageStack image optimiser for catalogue images, see
pagespeed Disallow "*/media/catalog/product/*";

# This setting should be enabled when using HTTPS
# Take care when using HTTP > HTTPS redirection to avoid loops
#pagespeed MapOriginDomain;

# If using Varnish with PageSpeed, consider uncommenting the following line
# as beacons may not have a true chance to operate (they require several page loads)
#pagespeed CriticalImagesBeaconEnabled false;

pagespeed EnableFilters extend_cache;

pagespeed EnableFilters lazyload_images;
pagespeed LazyloadImagesAfterOnload off;
pagespeed LazyloadImagesBlankUrl "";
pagespeed EnableFilters rewrite_images;
# Not all browsers support WebP and if using Varnish, you can improve hit rate considerably
# by not converting images to webp. Contact Sonassi support if using Varnish with PageSpeed to
# improve hit rate
pagespeed DisableFilters convert_jpeg_to_webp,convert_to_webp_lossless,convert_to_webp_animated,recompress_webp;
# This should be tested, or it can produce undesirable results with JS sliders
#pagespeed EnableFilters insert_image_dimensions;

# This can cause issues with the Magento admin image uploader
pagespeed EnableFilters collapse_whitespace;

# Do not use this option in conjunction with EcomDev_Varnish
pagespeed EnableFilters remove_comments;

pagespeed EnableFilters move_css_above_scripts;
# It is preferred to use Lesti Merge, versus using these settings
#pagespeed EnableFilters rewrite_css;
#pagespeed EnableFilters combine_css;

pagespeed EnableFilters inline_javascript;
pagespeed EnableFilters defer_javascript;
# It is preferred to use Lesti Merge, versus using these settings
#pagespeed EnableFilters combine_javascript;
#pagespeed EnableFilters rewrite_javascript;

pagespeed MaxCombinedJsBytes 300000;
pagespeed CombineAcrossPaths on;

Then at the top of ___general/ add the following,

include /microcloud/domains/example/domains/;

Then reload Nginx.