Skip to content

Instantly share code, notes, and snippets.

@willmorgan
Created February 18, 2016 15:34
Show Gist options
  • Save willmorgan/4a3c95c3beda3e65bceb to your computer and use it in GitHub Desktop.
Save willmorgan/4a3c95c3beda3e65bceb to your computer and use it in GitHub Desktop.
SilverStripe mod_pagespeed install
<IfModule pagespeed_module>
ModPagespeed on
ModPagespeedDisallow "*/admin/*"
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
ModPagespeedLowercaseHtmlNames on
ModPagespeedEnableFilters prioritize_critical_css,defer_javascript
ModPagespeedEnableFilters convert_jpeg_to_webp,inline_preview_images
ModPagespeedEnableFilters collapse_whitespace,remove_comments
</IfModule>
# PageSpeed requires no HTTP transform restrictions:
HTTP:
cache_control:
no-transform: "false"
no-store: "false"
#!/usr/bin/env bash
echo "Installing mod_pagespeed"
sudo yum install -y at # if you do not already have 'at' installed
cd /tmp
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm
sudo rpm -U mod-pagespeed-stable_current_x86_64.rpm
@helenclarko
Copy link

Thanks for this!
I've been experiencing some issues with mod_pagespeed and silverstripe, but it could be Amazon EC2 also.

Was there any other steps to take.
This actually gets pagespeed to load on my silverstripe page, but the images don't load.
It rewrites the path to something that doesn't exist.

Thanks again,
-Helenclarko

@jinjie
Copy link

jinjie commented Jul 5, 2018

Was facing the same issue. It's about the .htaccess configuration within the "assets/" folder.

Use this .htaccess configuration:

AddHandler default-handler php phtml php3 php4 php5 inc

<IfModule mod_php5.c>
        php_flag engine off
</IfModule>

RewriteCond %{REQUEST_FILENAME} !\.(webp|html|htm|xhtml|js|css|bmp|png|gif|jpg|jpeg|ico|pcx|tif|tiff|au|mid|midi|mpa|mp3|ogg|m4a|ra|wma|wav|cda|avi|mpg|mpeg|asf|wmv|m4v|mov|mkv|mp4|ogv|webm|swf|flv|ram|rm|doc|docx|dotx|dotm|txt|rtf|xls|xlsx|xltx|xltm|pages|ppt|pptx|potx|potm|pps|csv|cab|arj|tar|zip|zipx|sit|sitx|gz|tgz|bz2|ace|arc|pkg|dmg|hqx|jar|xml|pdf|gpx|kml)$ [NC,OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* / [F]

More information: apache/incubator-pagespeed-mod#1531

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment