Google has recently published an Apache module which should optimize web sites delivery daynamically.
I was quite suspicious about such tool and though that this could only work at the costs of page outlook quality, meaning web pages not being displayed quite the same as the original. After experimenting with it I was quite please with it.

Google Reference and download pages:

Latest version (for developers):

After experimenting with it through a proxy server I configured in Apache here are the results I found so far with the current version of mod_pagespeed(ver. Before we get into the details of compilation and installation, here are my findings after moderately experimenting with an Apache proxy + mod_pagespeed:

After comparing size and number of HTTP requests, without and then with pagespeed, I can confidently conclude the following so far:

The Apache module mod_pagespeed does improve the speed and traffic load as follows:
– Average type pages are reduced around 54% of the original pages size.
– Average type pages create around 35% of the original number of HTTP requests.

Extra Notes:
– There doesn’t seem to be any advantage for text/html only pages(Pages without Images, CSS or JavaScript) other than the standard compression from deflate(gzip).
– Google pages are also not getting any better performance. Most probably because Google is already using the module they developed themselves and/or the module detects the Google pages and leaves then as-is.
– The following 2 so-far-experimental directives which are dealing with javascript and probably with CSS did modify the display of the pages slightly. Therefore I disabled them in the configuration described below.
ModPagespeedEnableFilters defer_javascript
ModPagespeedEnableFilters detect_reflow_with_defer_js

mod_pagespeed Installation

mod_pagespeed Apache Module comes as source or as ready-to-install binaries.

Compiling and installing from source:

Here are the steps I used to compile and install the module in a Debian Squeeze environment where I had also compiled Apache 2.2.21.

For a more complete overview on how to install the module from source see the following link:

Require Apache (>= 2.2), Python (>= 2.6), g++ (>= 4.1), svn, git, gperf, and make.
apt-get install apache2 g++ python subversion gperf make devscripts fakeroot git
# Install the Chromium Depot Tools
mkdir -p ~/bin
cd ~/bin
svn co

Put the depot_tools in your bash PATH
echo 'export PATH=$PATH:~/bin/depot_tools' >> .bashrc
. .bashrc

Check out mod_pagespeed and dependencies
mkdir ~/mod_pagespeed
cd ~/mod_pagespeed
gclient config
gclient sync --force --jobs=1

Run Tests
cd ~/mod_pagespeed/src
make BUILDTYPE=Release mod_pagespeed_test pagespeed_automatic_test

Compile the module
make BUILDTYPE=Release
cd install

Install it within your compiled Apache environment
chmod 755 ./
APXS_BIN=/www/src/apache-2.2.21/bin/apxs ./

Apache configuration
In Apache I created a global configuration file and a vhost configuration to be included in vVirtualHosts using the Include command. This allow to selectively turn the module ON for VirtualHosts that need it.

Add in file: httpd.conf
Include conf/always_allowed.conf
Include conf/pagespeed_global.conf

Content of conf/always_allowed.conf
# Itself
SetEnvIf Remote_Host IP_ALLOWED
# Other fixed IPs that are allowed to us the proxy without authentication
SetEnvIf Remote_Host IP_ALLOWED

Content of file conf/pagespeed_global.conf
<IfModule !mod_version.c>
LoadModule version_module /www/apache/modules/
<IfVersion < 2.4>
<IfModule !pagespeed_module>
LoadModule pagespeed_module /www/apache/modules/
<IfModule !mod_deflate.c>
LoadModule deflate_module /www/apache/modules/
<IfModule pagespeed_module>
ModPagespeed off
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
ModPagespeedFileCachePath "/var/mod_pagespeed/cache/"
ModPagespeedGeneratedFilePrefix "/var/mod_pagespeed/files/"
ModPagespeedRewriteLevel CoreFilters
ModPagespeedAvoidRenamingIntrospectiveJavascript on
ModPagespeedEnableFilters add_instrumentation
ModPagespeedMessageBufferSize 100000
<Location /mod_pagespeed_beacon>
SetHandler mod_pagespeed_beacon
Order deny,allow
Deny from all
Allow From env=IP_ALLOWED
<Location /mod_pagespeed_statistics>
SetHandler mod_pagespeed_statistics
Order deny,allow
Deny from all
Allow From env=IP_ALLOWED
<Location /mod_pagespeed_message>
SetHandler mod_pagespeed_message
Order deny,allow
Deny from all
Allow From env=IP_ALLOWED
<Location /mod_pagespeed_referer_statistics>
SetHandler mod_pagespeed_referer_statistics
Order deny,allow
Deny from all
Allow From env=IP_ALLOWED

In each vhost which should use mod_pagespeed
Include conf/pagespeed_vhost.conf

Content of conf/pagespeed_vhost.conf
<IfModule pagespeed_module>
# Turn on mod_pagespeed. To completely disable mod_pagespeed, you
# can set this to "off".
ModPagespeed on
ModPagespeedFileCachePath "/var/mod_pagespeed/cache/"
ModPagespeedGeneratedFilePrefix "/var/mod_pagespeed/files/"
# Added some directives suggested from
ModPagespeedDomain *
ModPagespeedRewriteLevel CoreFilters
ModPagespeedEnableFilters rewrite_images
ModPagespeedEnableFilters combine_heads
ModPagespeedEnableFilters combine_javascript
ModPagespeedEnableFilters convert_jpeg_to_webp
ModPagespeedEnableFilters convert_png_to_jpeg
ModPagespeedEnableFilters inline_preview_images
ModPagespeedEnableFilters make_google_analytics_async
ModPagespeedEnableFilters move_css_above_scripts
ModPagespeedEnableFilters move_css_to_head
ModPagespeedEnableFilters prioritize_visible_content
ModPagespeedEnableFilters resize_mobile_images
ModPagespeedEnableFilters sprite_images
# These filter has a tendency to modify the CSS/JS
# ModPagespeedEnableFilters defer_javascript
# ModPagespeedEnableFilters detect_reflow_with_defer_js
ModPagespeedEnableFilters lazyload_images
ModPagespeedJpegRecompressionQuality 75
ModPagespeedFetcherTimeoutMs 3000
ModPagespeedFetchWithGzip on
SetOutputFilter DEFLATE

Example of Apache proxy + mod_pagespeed

Listen 81
# Reroutes the requests from my network on Port 81 to the world (acts as proxy)
# Handles HTTP and HTTPS (if mod_proxy_connect is loaded
# Uses mod_pagespeed module to cache and rework the web sites
<VirtualHost *:81>
Include conf/pagespeed_vhosts.conf
ProxyRequests On
<Proxy *>
AddDefaultCharset off
Order deny,allow
Deny from all
Allow From env=IP_ALLOWED
ProxyPreserveHost On
ProxyStatus On
ProxyBadHeader Ignore
ProxyVia On
CustomLog logs/proxy-01_access.log combined
ErrorLog logs/proxy-01_error.log

Install binaries mod_pagespeed on Debian Squeeze

Download the mod_pagespeed from this Google page:
Install it
dpkg -i mod-pagespeed-*.deb
apt-get -f install

Apache configuration
Use the same configuration shown above.

In case you want to test the features before you install it you sign-up to this Beta Service from Google at: