{"id":1643,"date":"2013-08-19T13:20:30","date_gmt":"2013-08-19T13:20:30","guid":{"rendered":"http:\/\/www.sitekickr.com\/blog\/?p=1643"},"modified":"2016-04-07T12:57:47","modified_gmt":"2016-04-07T12:57:47","slug":"googles-pagespeed-module-apache","status":"publish","type":"post","link":"https:\/\/www.sitekickr.com\/blog\/googles-pagespeed-module-apache\/","title":{"rendered":"Using Google&#8217;s New PageSpeed Module for Apache"},"content":{"rendered":"<p>Google&#8217;s new <a href=\"https:\/\/developers.google.com\/speed\/pagespeed\/module\" target=\"_blank\">PageSpeed Apache Module<\/a> is incredible. The number of options available to improve performance on the assets served from your web server will blow your mind. I found that the default configuration worked well, but I did decide to add a few options that weren&#8217;t part of their &#8220;core set&#8221;.<\/p>\n<p>I did however hit a few snags in the installation and configuration of the module. Nothing serious, but I thought it was worth pointing them out, in case others run into the same problems.<\/p>\n<h3><\/h3>\n<h3>Installation<\/h3>\n<p><code>&gt; yum install at<\/code><\/p>\n<p><span style=\"color: #00f;\">Package at-&#8230; already installed and latest version<\/span><\/p>\n<p><span style=\"color: #00f;\">Nothing to do<\/span><\/p>\n<p>This is okay, it just means that at is already installed.<\/p>\n<p><span style=\"text-decoration: line-through;\"><code><br \/>\n&gt; rpm -U mod-pagespeed-*.rpm<\/code><\/span><\/p>\n<p><span style=\"color: #00f;\">error: File not found by glob: mod-pagespeed-*.rpm<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>The error occurs because the -U option means upgrade. I&#8217;m not sure why Google suggests using this option in their installation docs.<\/p>\n<p>The approach that works is:<\/p>\n<p><code>&gt; rpm -i mod-pagespeed-*.rpm<\/code><\/p>\n<p>If it works, great. If not, you might get an error like this:<\/p>\n<p><span style=\"color: #00f;\">error: File not found by glob: mod-pagespeed-*.rpm<\/span><\/p>\n<p>In this case, try installing with <em>yum<\/em>. You&#8217;ll need to setup the correct repositories first. This <a href=\"http:\/\/www.tecmint.com\/install-mod_pagespeed-website-optimizer-for-apache-in-rhel-centos-and-fedora\/\" target=\"_blank\">post<\/a> has detail on setting up the repos, then installing with yum.<\/p>\n<p>&nbsp;<\/p>\n<h3>Configuration<\/h3>\n<p>At this point, if you&#8217;ve installed an Apache module before, you assume that you need to head over to your httpd.conf file and add this line:<\/p>\n<p><span style=\"text-decoration: line-through;\"><code>LoadModule pagespeed_module modules\/mod_pagespeed.so<\/code><\/span><\/p>\n<div><strong>Not true!<\/strong><\/div>\n<div><\/div>\n<p>The PageSpeed Module has already been added to Apache&#8217;s config, even though you don&#8217;t see a LoadModule directive.<\/p>\n<p>The installation process actually created a new configuration file in your server&#8217;s conf.d directory. This file is called pagespeed.conf.<\/p>\n<p>The installation actually assumes that your httpd.conf has the following directive in place:<\/p>\n<p><code>Include conf.d\/*.conf<\/code><\/p>\n<p>Apache comes standard with this directive in place, but some admins and hosts remove this line for security reasons (so any script or unauthorized person can&#8217;t just place a conf file in the conf.d folder). So, keep this in mind if the module does not load automatically for you.<br \/>\nOh, once your done configuring, don&#8217;t forget to restart apache!<\/p>\n<p>&nbsp;<\/p>\n<h3>Tips<\/h3>\n<ol>\n<li>You may find that PageSpeed&#8217;s server-side caching is a little to strong when you are in development mode on a website. Luckily, you can turn off page speed on an individual virtual host basis, i.e.:<code>&lt;VirtualHost *:80&gt;<br \/>\nServerName dev.mysite.com<br \/>\nDocumentRoot \/var\/www\/html\/mysite_com\/dev<\/code><\/p>\n<p>ModPagespeed Off<\/p>\n<p>&lt;\/VirtualHost&gt;<\/li>\n<li>If you need to make a quick change to a site that has mod_pagespeed enabled, just append\n<pre class=\"prettyprint\" style=\"margin: 1.5em 0px; padding: 6px 10px; border: 1px solid #bbbbbb; font-weight: normal; font-style: normal; font-size: 13px; font-family: 'Droid Sans Mono', monospace; vertical-align: baseline; white-space: pre; font-variant: normal; line-height: 1.5; color: #007000; background-color: #fafafa; overflow: auto; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;\"><span class=\"str\" style=\"margin: 0px; padding: 0px; border: 0px; font-weight: inherit; font-style: inherit; font-size: 13px; font-family: inherit; vertical-align: baseline; color: #008800;\">?ModPagespeed=off<\/span><\/pre>\n<p>to the URL. This query string parameter will cause mod_pagespeed to disable itself.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Google&#8217;s new PageSpeed Apache Module is incredible. I did however hit a few snags in the installation and configuration of the module. Nothing serious, but I thought it was worth pointing them out, in case others run into the same problems.<\/p>\n","protected":false},"author":1,"featured_media":1647,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"amp_status":""},"categories":[237,41],"tags":[151],"_links":{"self":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/1643"}],"collection":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/comments?post=1643"}],"version-history":[{"count":11,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/1643\/revisions"}],"predecessor-version":[{"id":2477,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/1643\/revisions\/2477"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/media\/1647"}],"wp:attachment":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/media?parent=1643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/categories?post=1643"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/tags?post=1643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}