Skip to content

Instantly share code, notes, and snippets.

@bjinwright
Created May 10, 2013 15:01
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bjinwright/5554958 to your computer and use it in GitHub Desktop.
Save bjinwright/5554958 to your computer and use it in GitHub Desktop.
Example mod_pagespeed conf for AWS Elastic Beanstalk.
# mod_deflate configuration
<IfModule mod_deflate.c>
# Restrict compression to these MIME types
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xml+rss
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE image/png
AddOutputFilterByType DEFLATE image/gif
AddOutputFilterByType DEFLATE image/jpeg
# Level of compression (Highest 9 - Lowest 1)
DeflateCompressionLevel 9
# Netscape 4.x has some problems.
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
<IfModule mod_headers.c>
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
</IfModule>
ModPagespeedEnableFilters rewrite_domains
ModPagespeedEnableFilters trim_urls
#Example of setting up a CDN
ModPagespeedMapRewriteDomain https://example.cloudfront.net example.com
ModPagespeedEnableFilters extend_cache
ModPagespeedEnableFilters collapse_whitespace
ModPagespeedEnableFilters combine_javascript
ModPagespeedEnableFilters insert_dns_prefetch
ModPagespeedEnableFilters rewrite_javascript
<FilesMatch "\.(jpg|jpeg|gif|png|js|css)$">
Header set Cache-control "public, max-age=300"
</FilesMatch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment