blob: f6a2c06697f261a13c40cb96e630d19bb4412d36 [file] [log] [blame]
# This is a sample configuration file for mod_pagespeed. It must be edited by
# the installer to provide the correct HOSTNAME under ModPagespeedUrlPrefix.
#
# This sample config file also turns on "gzip" for html, css, and javascript,
# which is generally best practice.
<IfModule pagespeed_module>
# Direct Apache to send all HTML output to the mod_pagespeed output handler.
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
# This page lets you view statistics about the mod_pagespeed module.
<Location /mod_pagespeed_statistics>
Order allow,deny
# You may insert other "Allow from" lines to add hosts you want to
# allow to look at generated statistics. Another possibility is
# to comment out the "Order" and "Allow" options from the config
# file, to allow any client that can reach your server to examine
# statistics. This might be appropriate in an experimental setup or
# if the Apache server is protected by a reverse proxy that will
# filter URLs in some fashion.
Allow from localhost
SetHandler mod_pagespeed_statistics
</Location>
# This handles the client-side instrumentation callbacks which are injected
# by the add_instrumentation filter.
# You can use a different location by adding the ModPagespeedBeaconUrl
# directive; see the documentation on add_instrumentation.
<Location /mod_pagespeed_beacon>
SetHandler mod_pagespeed_beacon
</Location>
ModPagespeed on
# TODO(jmaessen) This parameter will no longer be relevant once the new
# resource naming spec is implemented.
ModPagespeedUrlPrefix "http://HOSTNAME/mod_pagespeed/"
ModPagespeedFileCachePath "MOD_PAGESPEED_FILE_ROOT/cache/"
ModPagespeedFileCacheSizeKb 102400
ModPagespeedFileCacheCleanIntervalMs 3600000
ModPagespeedGeneratedFilePrefix "MOD_PAGESPEED_FILE_ROOT/files/"
ModPagespeedLRUCacheKbPerProcess 1024
ModPagespeedLRUCacheByteLimit 16384
ModPagespeedCssInlineMaxBytes 2048
ModPagespeedImgInlineMaxBytes 2048
ModPagespeedJsInlineMaxBytes 2048
ModPagespeedCssOutlineMinBytes 3000
ModPagespeedJsOutlineMinBytes 3000
# Override the mod_pagespeed 'rewrite level'. The default level
# "CoreFilters" uses a set of rewrite filters that are generally
# safe for most web pages. Most sites should not need to change
# this value and can instead fine-tune the configuration using the
# ModPagespeedDisableFilters and ModPagespeedEnableFilters
# directives, below. Valid values for ModPagespeedRewriteLevel are
# PassThrough and CoreFilters.
#
# ModPagespeedRewriteLevel CoreFilters
# Explicitly disables specific filters. This is useful in
# conjuction with ModPagespeedRewriteLevel. For instance, if one
# of the filters in the CoreFilters needs to be disabled for a
# site, that filter can be added to
# ModPagespeedDisableFilters. This directive contains a
# comma-separated list of filter names, and can be repeated.
#
# ModPagespeedDisableFilters rewrite_javascript
# Explicitly enables specific filters. This is useful in
# conjuction with ModPagespeedRewriteLevel. For instance, filters
# not included in the CoreFilters may be enabled using this
# directive. This directive contains a comma-separated list of
# filter names, and can be repeated.
#
# ModPagespeedEnableFilters collapse_whitespace,elide_attributes
# ModPagespeedDomain
# authorizes rewriting of JS, CSS, and Image files found in this
# domain. By default only resources with the same origin as the
# HTML file are rewritten. For example:
#
# ModPagespeedDomain cdn.myhost.com
#
# This will allow resources found on http://cdn.myhost.com to be
# rewritten in addition to those in the same domain as the HTML.
#
# Wildcards (* and ?) are allowed in the domain specification. Be
# careful when using them as if you rewrite domains that do not
# send you traffic, then the site receiving the traffic will not
# know how to serve the rewritten content.
# When Apache is set up as a browser proxy, mod_pagespeed can record
# web-sites as they are requested, so that an image of the web is built
# up in the directory of a users choosing.
SLURP_DIR_COMMAND
SLURP_READ_ONLY_COMMAND
</IfModule>
# These caching headers are set up for the mod_pagespeed example, and
# also serve as a demonstration of good values to set for the entire
# site, if it is to be optimized by mod_pagespeed.
<Directory APACHE_DOC_ROOT/mod_pagespeed_example>
<IfModule headers_module>
# To enable to show that mod_pagespeed to rewrites web pages, we must
# turn off Etags for HTML files and eliminate caching altogether.
# mod_pagespeed should rewrite HTML files each time they are served.
# The first time mod_pagespeed sees an HTML file, it may not optimize
# it fully. It will optimize better after the second view. Caching
# defeats this behavior.
<FilesMatch "\.(html|htm)$">
Header unset Etag
Header set Cache-control "max-age=0, no-cache, no-store"
</FilesMatch>
# Images, styles, and javascript are all cache-extended for
# a year by rewriting URLs to include a content hash. mod_pagespeed
# can only do this if the resources are cacheable in the first place.
# The origin caching policy, set here to 10 minutes, dictates how
# frequently mod_pagespeed must re-read the content files and recompute
# the content-hash. As long as the content doesn't actually change,
# the content-hash will remain the same, and the resources stored
# in browser caches will stay relevant.
<FilesMatch "\.(jpg|jpeg|gif|png|js|css)$">
Header unset Etag
Header set Cache-control "public, max-age=600"
</FilesMatch>
</IfModule>
</Directory>