My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
FAQ  
Frequently Asked Questions
Updated Dec 1, 2011 by sligocki@google.com

If you're having trouble with mod_pagespeed, we'd love to hear about it on the mailing list. But first, check below to see if your question has already been answered.

Please do not post new questions to this page; if you do they will be deleted and moved to the mailing list. But if you spot a recurring theme on the mailing list, feel free to post the question and answer below on this page.

When will you support my favorite OS/http server/protocol/ice cream flavor?

While we have no dates to announce for upcoming releases, we definitely want to know what you think we should be working on. Please click on the "Issues" tab, and search for your feature. (If you don't find it, open a new issue and tag it "Type-Enhancement"). Then click on the Star icon in the top left of the Issue page. That way, we'll know how many people are interested, and you'll get any updates we post about that feature.

I installed mod_pagespeed; why isn't it rewriting any of my pages?

  1. Check the HTTP response headers from your page (e.g., run curl -D - http://example.com). Look for a header like X-Mod-Pagespeed: 0.9.0.0-215. If you don't see one, this means that Apache is not adding mod_pagespeed to the filter chain, meaning the problem is probably in your Apache .conf files. One possible cause for this is multiple references to SetOutputFilter: only one of those will win. See http://httpd.apache.org/docs/current/mod/core.html#addoutputfilterbytype
  2. It's possible that none of the active mod_pagepspeed rewriters found anything useful to rewrite in your page. Try enabling more aggressive ones!
  3. mod_pagespeed cannot optimize resources (css, js, or images) that are marked as cache-control:nocache or cache-control:private. If your default caching headers are marked as such, mod-pagespeed will not rewrite the resources.
  4. mod_pagespeed cannot minify CSS files that it cannot parse, specifically it will fail on certain proprietary and CSS3 syntaxes (See  issue 108 ).
  5. We intentionally don't allow fetching and rewriting HTTPS resources (so we don't open up security holes in your server).

I am using WordPress and my pages are blank. What gives?

Disable compression in the WordPress plugin, so that mod_pagespeed will process uncompressed HTML. mod_pagespeed automatically adds mod_deflate to the filter after running, so the optimized HTML will be compressed before serving.

I installed Apache 2.2 using cPanel, and can't get mod_pagespeed to work when I install from the .deb or .rpm. Little help?

In order to use mod_pagespeed packages (.rpm, .deb) from the download site you must have installed Apache httpd from a package manager. If you compiled them from source (for example, using cPanel/EasyApache) then you cannot use the packages. Instead you need to install from source using the instructions at HowToBuild. If you try to install the .deb or .rpm you may either get an error at installation time, or you may simply discover that apache isn't running mod_pagespeed as you expect.

We have an open Enhancement to make this easier for people using cPanel EasyApache. You can also try to follow this tutorial: http://www.technomenace.com/2010/11/install-mod_pagespeed_in_apache_for_cpanel/ We have not tried this and cannot vouch for it, so let us know if it fails.

mod_pagespeed broke my site; what do I do?

First of all, sorry about that. We put a lot of work into validating our rewriters against a large corpus of websites and we disable filters that cause problems as soon as we can, but sometimes things slip through.

Second, please upgrade to the latest version; we are continually working on bug-fixes and turning off filters that break pages.

If it's still breaking your site, please post a bug at http://code.google.com/p/modpagespeed/issues/list . If you can, including the following information will make it much easier to diagnose:

  1. Try appending ?ModPagespeed=off to the URL. This de-activates mod_pagespeed module. If the site is still broken, it is not a rewrite or HTML parsing problem. It might be a configuration clash, please ask us at mod-pagespeed-discuss@googlegroups.com or file a bug.
  2. If that fixed the site, try appending ?ModPagespeed=on&ModPagespeedFilters= to the URL. This turns on mod_pagespeed, but no filters. If the site is broken now, it is an HTML parsing problem. Please let us know.
  3. If the site still worked, try appending ?ModPagespeed=on&ModPagespeedFilters=foo for various filters "foo". For example try:
  4. http://www.modpagespeed.com/?ModPagespeed=on&ModPagespeedFilters=extend_cache
    http://www.modpagespeed.com/?ModPagespeed=on&ModPagespeedFilters=combine_css
    http://www.modpagespeed.com/?ModPagespeed=on&ModPagespeedFilters=inline_css
    http://www.modpagespeed.com/?ModPagespeed=on&ModPagespeedFilters=inline_javascript
    http://www.modpagespeed.com/?ModPagespeed=on&ModPagespeedFilters=insert_img_dimensions
    http://www.modpagespeed.com/?ModPagespeed=on&ModPagespeedFilters=rewrite_images
    http://www.modpagespeed.com/?ModPagespeed=on&ModPagespeedFilters=rewrite_css
    http://www.modpagespeed.com/?ModPagespeed=on&ModPagespeedFilters=rewrite_javascript

You may have to reload them a few times over several seconds to make sure they have had time to load sub-resources into cache and rewrite them. If one of these breaks your site, you now know which filter is at fault. Please post a bug to let us know. You can disable that filter by adding a line to your pagespeed.conf file:

   ModPagespeedDisableFilters foo

Apache will not restart unless I disable mod_pagespeed! What's up with that?

If you see error messages similar to this:

[Thu Nov 04 01:00:25 2010] [error] [1104/010025:ERROR:net/instaweb/apache/apr_statistics.cc(97)] Variable serf_fetch_cancel_count cannot create mutex: No space left on device /etc/apache2/mod_pagespeed/stats_mutex.serf_fetch_cancel_count

or

[Sat Oct 16 21:22:46 2010] [warn] pid file /usr/local/apache2/logs/httpd.pid
# overwritten -- Unclean shutdown of previous Apache run?

then Apache previously exited uncleanly, and mod_pagespesed left behind some shared memory segments that need to be cleaned. Try this SharedMemoryCleanupScript.

mod_pagespeed does not pick up changes when I edit css or javascript files

There are two distinct cache-times at play when you use mod_pagespeed:

  1. The origin TTL which mod_pagespeed uses to refresh its internal server-side cache
  2. The TTL with which mod_pagespeed serves rewritten resources to browsers.

When mod_pagespeed first reads your reousrce file, it uses the origin TTL to figure out how often to re-examine the origin CSS file. Assume your origin TTL is 1 day. Once mod_pagespeed as that file in cache, it will not go back & re-check that file for a day. Changing the TTL after mod_pagespeed has put the resource in its cache will not help because mod_pagespeed is not going to reload the resource until the one in its cache expires, or the cache is cleared. You can clear the cache per the instructions below.

We recommend an origin TTL of 10 minutes, which provides reasonable responsiveness when you update a file. If you try to make it much smaller, then your server will need to refresh it more frequently. This adds server load and reduces optimization.

We are working on a better solution to this problem rather than forcing you to flush your server cache while you are developing. See http://code.google.com/p/modpagespeed/issues/detail?id=133 .

How do I clear the cache on my server?

Usually this should only be necessary if a new version of mod_pagespeed is installed, and the cache has invalid data from a previous version. To clear the cache with minimal server downtime, type:

  sudo /etc/init.d/apachectl stop
  sudo mv /var/mod_pagespeed/cache /var/mod_pagespeed/cache.old
  sudo /etc/init.d/apachectl start
  sudo rm -rf  /var/mod_pagespeed/cache.old

These paths and commands are for Debian/Ubuntu; adjust accordingly for other distributions.

Why is mod_pagespeed giving me errors in jquery or js_tinyMCE?

Some Javascript libraries that are sensitive to their own names. This sensitivity might result from a DOM search from javascript for its own script node.

To workaround this problem, use the ModPagespeedDisallow directive in the configuration file.

  ModPagespeedDisallow */jquery-ui-1.8.2.custom.min.js
  ModPagespeedDisallow */js_tinyMCE.js

This way mod_pagespeed can continue to operate on the other elements of the web page.

Note: This option was added in mod_pagespeed 0.9.11.1-271

One idea is for mod_pagespeed to blacklist certain files by default that have been known to introspect their own URLs. This is tracked in http://code.google.com/p/modpagespeed/issues/detail?id=268.

What's with all these 'serf' errors in my logs? Error status=670003 (Temporary failure in name resolution)

This can happen when the DNS cannot be accessed accurately from the server. Thus sub-resources cannot be fetched and rewritten correctly.

To test that this is the case try ssh-ing into your machine and wget-ing a URL:

  $ ssh YOUR_SITE
  $ wget http://YOUR_SITE/

If this fails, then DNS is not accessible or there is some other networking issue stopping you from accessing your host from itself.

One solution is to use origin-mapping to indicate the host from which the resources should be fetched.

  ModPagespeedMapOriginDomain localhost www.example.com

This bypasses DNS lookup by telling mod_pagespeed to get all resources for domain www.example.com from localhost.

This can also be used to improve the performance of mod_pagespeed when it is sitting behind a load balancer. It may be preferable to use localhost to load the resources rather than going out to the load-balancer and back.

Can I move mod_pagespeed's file-based cache into RAM?

Why yes, you can. mod_pagespeed uses the file system for its cache implementation. There is no requirement that this be a physical disk. Disk pressure will be reduced and performance may be improved by using a memory-based file system.

Put this in /etc/fstab, please change the uid & guid to the appropiate user & group of your apache webserver, and the path to your needs. Feel free to change the size (here it is 256Mb):

tmpfs /var/www/mod_pagespeed/cache tmpfs size=256m,mode=0775,uid=httpd,gid=httpd 0 0

Save it, and after that mount the tmpfs:

mount /var/www/mod_pagespeed/cache

Why don't you allow source-installs via ./configure && make?

mod_pagespeed is dependent on at least two other packages that use 'gclient': http://code.google.com/p/page-speed/ and http://code.google.com/p/chromium/. So for us to switch away from this build methodology we'd have to either:

(a) rewrite the functionality we get for free from other packages

OR

(b) get the Page Speed & Chromium teams to switch methodologies AND
document to our source installers that they must configure&make about 10 other packages before they could compile ours.

To do either of those would cost us a lot of development time that we'd prefer to spend making mod_pagespeed better.

The benefit of gclient, besides beyond done, is that it lets us control explicitly which library versions we link in of a large number of direct & transitive dependencies, helping us create a consistent experience for our source-code builds. If we had to ask our source-code installers to configure&&make multiple dependent libraries there would likely be a lot of version-incompatibilities.

Why is my Google Analytics data being inflated by "Serf"?

If you track page views by using a tracking image, you will need to explicitly tell mod_pagespeed not to try to fetch that image. For example if your tracking image is

<img src="/ga.php?utmac=...">

you should add

ModPagespeedDisallow */ga.php*

to your pagespeed.conf file.

mod_pagespeed does not rewrite pages produced from mod_php

mod_pagespeed only rewrites pages specifically marked as "Content-Type: text/html" (and a few other HTML types). If you dynamically generate your pages from mod_php, you need PHP to set this header correctly.

One way to do this is to use the header function (http://php.net/manual/en/function.header.php). For example:

<?php
header('Content-Type: text/html')
?>

At the top of your PHP file.


Thanks to contributors on mod-pagespeed-discuss@googlegroups.com

  • yogeshsarkar@gmail.com
  • pdreissen@gmail.com
Comment by marcel.w...@gmail.com, Oct 27, 2011

For minimal server downtime when clearing a large cache folder I recommend:

1. Edit your apache configuration and set mod page speed to off 2. Restart apache 3. move cache folder to cache.old 4. Edit apache configuration and set mod page speed to on 5. Restart apache 6. rm -rf your cache.old folder


Sign in to add a comment
Powered by Google Project Hosting