How to install mod_pagespeed module for apache on Debian 7 server

PageSpeed improves web page latency and bandwidth usage by changing the resources on that web page to implement web performance best practices. Each optimization is implemented as a custom filter in PageSpeed, which are executed when the HTTP server serves the website assets. Some filters simply alter the HTML content, and other filters change references to CSS, JavaScript, or images to point to more optimized versions.

PageSpeed implements custom optimization strategies for each type of asset referenced by the website, to make them smaller, reduce the loading time, and extend the cache lifetime of each asset. These optimizations include combining and minifying JavaScript and CSS files, inlining small resources, and others. PageSpeed also dynamically optimizes images by removing unused meta-data from each file, resizing the images to specified dimensions, and re-encoding images to be served in the most efficient format available to the user.

PageSpeed ships with a set of core filters designed to safely optimize the content of your site without affecting the look or behavior of your site. In addition, it provides a number of more advanced filters which can be turned on by the site owner to gain higher performance improvements.

PageSpeed can be deployed and customized for individual web sites, as well as being used by large hosting providers and CDNs to help their users improve performance of their sites, lower the latency of their pages, and decrease bandwidth usage.


Automatic website and asset optimization
Latest web optimization techniques
40+ configurable optimization filters
Free, open-source, and frequently updated
Deployed by individual sites, hosting providers, CDNs

Install mod_pagespeed module for apache on Debian 7 server

Download .deb package using the following command

For 64-bit users


For 32-bit users


If you see any errors run the following command

#apt-get -f install

Remove the downloaded package

#rm mod-pagespeed-*.deb

After installation you need to restart the apache server

#service apache2 restart

Configuring mod_pagespeed module

Depending on the Apache version you’re running, you’ll get a different version of the module installed and enabled. If you’re running Apache 2.2, will be installed; Apache 2.4 users will use

Additionally, configuration files have been added to your Apache installation. The primary configuration file is pagespeed.conf.

This file is located in the following location


There are a few different ways mod_pagespeed can be configured. You can use the pagespeed.conf file described above to configure it for the whole server. Or, if you’d rather, you can put your configuration settings in the VirtualHost directive for an Apache virtual host/website. Finally, you have the option of specifying directives in a .htaccess file, such as what most sites do for mod_rewrite.

You can use whatever text editor you want to edit the configuration file.

To start editing the main configuration file, use the following command

#vi /etc/apache2/mods-available/pagespeed.conf

Basic Settings

In general, the settings in pagespeed.conf are pretty well documented inside the file. There is also a great list of filter examples available from Here are a few common settings you might want to play with to optimize for your site’s performance.

Turn mod_pagespeed On/Off

First off, you can turn the module on or off with the ModPagespeed setting.

ModPagespeed on


ModPagespeed off

You can check the more configuration details from here

Sponsored Link

Leave a comment

Your email address will not be published. Required fields are marked *