After adding few of tutorials about PHP optimizers like Memcached, XCache and PHP eAccelerator. Which are used to optimize php scripts by caching them in compiled state. This article will help you to configure mod_pagespeed to optimize Apache server performance.
Ther are number of features availble in mod_pagespeed, Find the list of few important features:
- 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
This article will help you to how to install
Step 1 – Installation
Google Mod_pagespeed provides rpm packages to install on your CentOS systems. Use the following commands to download latest module packages on your system.
For 64-bit systemswget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm For 32-bit systems$ wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_i386.rpm
Install the downloaded packages as well as at package on your system.
# yum install at # rpm -Uvh mod-pagespeed-*.rpm
Here is the list of module and configuration files used by mod_pagespeed.
- /etc/httpd/conf.d/pagespeed.conf : Main configuration file for Apache.
- /usr/lib/httpd/modules/mod_pagespeed.so : module for Apache.
- /var/www/mod_pagespeed/cache : Directory used to File caching
Step 2 – Configure Mod_pagespeed
By default mod_pagespeed module is enabled, If you want to change it, edit mod_pagespeed Apache configuration file and find below switch. Set this parameter on to enable this and set off to disable.
Enable mod_pagespeed add this to configuration file.
To disable HTML rewriting but continue to serve .pagespeed. resources and parse query options.
To completely disable mod_pagespeed use unplugged option.
After making any changes to configuration files, You need to restart the web server.
# service httpd restart
Step 3 – Verify Module
The default installation setting are fine to use mod_pagespeed module. Now create a php info file under document root of you website and add following content.
# vim /var/www/html/info.php
Access info.php file in the browser and search for content highlighted in below screenshot.