Cédric Walter | Oct 8, 2020 | 0
Need for Speed? mod_pagespeed from Google
mod_pagespeed is the latest addition to our family of products, performing on-the-fly optimization in the Apache™ 2 HTTP Server. It provides webmasters and web developers that manage their Apache 2 configuration with technology that applies Page Speed performance best practices automatically. Webmasters can get the benefits of the optimizations without having to manually going back and fixing the performance issues that Page Speed detects.
This solution is valid if you do not want to carefully optimize your site, and it come for now at huge initial CPU costs till the cache is filled up. The load on my server has proven to be unacceptable (for me) and I was forced to switch it off. But it may work on your server depending on the page size, number of visitors. Authors are working hard and communicating a lot on the official mailing list to reduce that load and improve the code in the coming weeks
If you trust me, you can download the library module libmod_pagespeed.so for Apache 2.2
Check before installing the MD5 keys of this file
# md5sum -b mod_pagespeed.so 187995e3623a222ec5b54c331ee7ffaa *mod_pagespeed.so
If it matches, drop it into your Apache library folder /usr/lib64/apache2/
Build Apache module mod_pagespeed yourself
On my OpenSuSE system, I was forced to install first
zypper in gcc-c++
you should get after a successful build
Install the module library
cp ./out/Release/libmod_pagespeed.so /usr/lib64/apache2/mod_pagespeed.so
After installing mod_pagespeed, it can be customized and configured by editing the Apache configuration file
so you can run
# cp ./out/Release/install/common/pagespeed.conf /etc/apache2/conf.d/pagespeed.conf
Create some directories
# mkdir /var/mod_pagespeed/ # mkdir /var/mod_pagespeed/cache/ # mkdir /var/mod_pagespeed/files
Has to be writtable by apache
chown -R wwwrun:www /var/mod_pagespeed/
and finally restart apache
There is a lot of available settings that are all well explained in this page http://code.google.com/speed/page-speed/docs/using_mod.html
Here is my /etc/apache2/conf.d/pagespeed.conf stripped of all comments as an example:
You may be forced to remove mod_deflate
You can disable mod_pagespeed by adding in the url ?mod_page_speed=0
Some mod_pagespeed filters
- add_instrumentation Adds client-side latency instrumentation.
- extend_cache Improves cacheability.
- collapse_whitespace Removes unnecessary whitespace in HTML.
- combine_css Combines multiple CSS files into one.
- combine_heads Combines multiple elements into one.
- move_css_to_head Moves CSS into the element.
- elide_attributes Removes unnecessary attributes in HTML tags.
- inline_css Inlines small external CSS files.
- outline_css Moves large inline tags into external files for cacheability.
- remove_quotes Removes unnecessary quotes in HTML tags.
- remove_comments Removes HTML comments.
- rewrite_css Minifies CSS.
- rewrite_images Rescales, and compresses images; inlines small ones.