As we define a set of rules to govern a Country or manage ourselves, google led down some rules to verify your website performance by a tool called Page Speed Insight. Generally people get confused with page speed insight and mod_page speed. Page speed insight gives us the suggestions to optimize the website but mod_page speed does it from the server side.
Concatenating and minifying files, optimizing images, setting up caching can lead to good website performance but this is a manual tedious process. Google recognized this problem and came up with a web server module that would take of a whole bunch of website performance optimization for you; thus mod_pagespeed was born.
Website Performance Filters by mod_pagespeed:
The PageSpeed module (mod_pagespeed) contains a number of filters that are each responsible for taking care of an optimization task. By default, filters are enabled that handle:
- Image Optimization (Compression and Resizing)
- Asset Caching
As well as these common optimizations there are filters available for a wide range of other tasks, including:
- Removal of HTML Comments and Whitespace
- Lazy-loading Images (only loaded when they become visible in the viewport)
- Google Analytics Injection
Installing mod_pagespeed For Apache:
These are the procedures you need to follow to use mod_pagespeed with your apache server.
1. OPEN A CONNECTION TO YOUR SERVER
Start by opening up Terminal and creating a new SSH connection to your server
ssh user@hostname # e.g. ssh firstname.lastname@example.org
2. DOWNLOAD THE PACKAGE
Download the appropriate package for your server environment. You can use the wget program to save this file directly to your server.
wget <package url>
<package url> can be any of the following depending on your OS and architecture.
32 Bit (Debian/Ubuntu): https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_i386.deb
64 Bit (Debian/Ubuntu): https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb
32 Bit (CentOS/Fedora): https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_i386.rpm
64 Bit (CentOS/Fedora): https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm
3. INSTALL THE PACKAGE
Next you need to install the package. Instructions for doing this vary depending on what type of server you are using.
For Debian/Ubuntu servers:
sudo dpkg -i mod-pagespeed-*.deb sudo apt-get -f install
For CentOS/Fedora servers:
# only if 'at' is not installed sudo yum install at # install the package sudo rpm -U mod-pagespeed-*.rpm
4. RESTART APACHE
The mod_pagespeed module should now be installed on your server. All you need to do now is restart Apache.
service apache2 restart
Simply by installing you will see effects on your website. The before and after image is attached to give you a understanding of hashing technique by mod_pagespeed.
PageSpeed uses three different levels to make configuration simple. The
CoreFilters level enables a default set of filters that will make your website faster. You can then enable or disable filters to modify the configuration as you wish.
Alternatively you can disable
CoreFilters by setting the
PassThrough. You will then need to manually enable all of the filters that you wish to use.
Unless you have some very specific requirements it’s often best to leave the
CoreFilters and then modify the enabled filters in the host configuration.
The OptimizeForBandwidth setting provides a stronger guarantee of safety and is suitable as a default setting for use with sites that are not aware of PageSpeed.
To enable a filter, use the
You can find a full list of the different filters available here.
Note than some filters rely on additional configuration variables, such as the
insert_ga filter which will automatically insert the Google Analytics code into your pages.
ModPagespeedEnableFilters insert_ga ModPagespeedAnalyticsID <Analytics ID>
Refer to the documentation for each of the options to find out if you need to set additional variables.
To disable a filter , use the
Specifying this in your host config will override the options specified in
As well as disabling filters you can also forbid virtual hosts from using specific filters. This is done using the
Forbidding access to filters can be useful if you manage a server that hosts many different websites.
4.DISABLING MOD_PAGESPEED FOR A WEBSITE
You can disable the PageSpeed module completely for a specific website by setting
off in your host configuration.
If you only need to temporarily disable mod_pagespeed for testing purposes, you can just add the
ModPagespeed=off query parameter to the URL.
Today Google considers website performance as a crucial factor for Search Engine rankings. So faster loading websites are not just trends, but a necessity for better Search Engine performance. So ensure that your website have optimal performance for best search engine performance and user experience. In case I missed any important points, please feel free to point out. Look forward for your valuable comments.