dotMobimobiForgemobiReadyDeviceAtlasgoMobi
background image

mod_pagespeed configuration notes

This page describes some additional mod_pagespeed configuration parameters related to our RESS image lightening article.

Additional mod_pagespeed Configuration Notes

mod_pagespeed has a couple of other useful tricks up its sleeve. First of all, for devices that support JavaScipt there is a useful lazy-loading option for images that prevents the browser from fetching images until they're actually needed for display on screen. This can significantly speed up the time taken to get the initial content. You can enable this with the following configuration parameter:

    ModPagespeedEnableFilters lazyload_images
 

Secondly, mod_pagespeed allows you to initially fetch a preview image while the full-sized image is being retrieved. Again, this requires JavaScript support on the requesting device but really helps in making the site feel fast. In conjunction with this option you should probably enable the resize_mobile_images option to ensure that mobile-sized previews are used.

    ModPagespeedEnableFilters inline_preview_images
    ModPagespeedEnableFilters resize_mobile_images
 

mod_pagespeed's beacon function also allows you to gather stats on page load time using a JavaScript beacon that is added into pages. The resulting information can be viewed via the mod_pagespeed logs in your browser.

    ModPagespeedEnableFilters add_instrumentation
 

You can fine-tune the image resizing behaviour with the ImageMaxRewritesAtOnce parameter. Refer to the documentation for more details.

Finally, mod_pagespeed can optionally apply further compression for the special case of small screens. This is configured as follows:

    ModPagespeedJpegRecompressionQualityForSmallScreens Quality
 

Note that mod_pagespeed can be configured to fetch images for resizing directly from disk rather than via the web server as follows:

    ModPagespeedLoadFromFile "http://www.example.com/static/" \
                             "/var/www/static/"