Optimal PageSpeed Configuration

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/example.com.pagespeed.conf, and replace the following to suit your stack,

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

pagespeed DownstreamCachePurgeLocationPrefix http://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 https://www.sonassi.com/help/performance/optimise-images
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 http://www.example.com https://www.example.com;

# 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 "https://www.gstatic.com/psa/static/1.gif";
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;

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/example.com.conf add the following,

include /microcloud/domains/example/domains/example.com/___general/example.com.pagespeed.conf;

Then reload Nginx.