mod_pagespeed is an open-source Apache & Nginx Web Server module created by Google to help Make the Web Faster by rewriting web pages to reduce latency and bandwidth. It has several filters that automatically optimize files like HTML, CSS, JavaScript, JPEG, PNG and other resources to speedup your website 30-40% compare with earlier stage. It support around 45 famous & most useful PageSpeed filters wihch will used to optimize your apache performance such a different aspect & parameter. The latest version of Pagespeed 1.9.32.13 released on February 03, 2016 with Security update, Still pagespeed team working hard to improve the performance.
1) Download & Install pagespeed module on RHEL/CentOS/Fedora
Before proceeding mod_pagespeed module, make sure you should install Apache Web Server on your environment. Follow the below steps to install mod_pagespeed module on your apache server.
[Download & Install mod_pagespeed 64-bit package] # rpm -Uvh https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm [Download & Install mod_pagespeed 32-bit package] # rpm -Uvh https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_i386.rpm [Install at command, if its not installed] # yum install at [It will automatically create the mod_pagespeed repo] # cat /etc/yum.repos.d/mod-pagespeed.repo [mod-pagespeed] name=mod-pagespeed baseurl=http://dl.google.com/linux/mod-pagespeed/rpm/stable/x86_64 enabled=1 gpgcheck=1
Note the mod_pagespeed files location for future usage.
[mod_pagespeed Config files /etc/httpd/conf.d/pagespeed.conf /etc/httpd/conf.d/pagespeed_libraries.conf [mod_pagespeed module for Apache 2.4 /etc/httpd/modules/mod_pagespeed_ap24.so [mod_pagespeed module for Apache 2.2 /etc/httpd/modules/mod_pagespeed.so [mod_pagespeed cron file /etc/cron.daily/mod-pagespeed
Change/Modify below File permission to 755.
[Change the file permission for Apache 2.4 # chmod 755 /etc/httpd/modules/mod_pagespeed_ap24.so [Change the file permission for Apache 2.2 # chmod 755 /etc/httpd/modules/mod_pagespeed.so
Restart Apache Web Server to take effect the changes.
[Restart Apache webserver on SysVinit systems] # service httpd restart [Restart Apache webserver on SysVinit systems] # systemctl restart httpd.service
2) Verify pagespeed is running with apache
Just create the phpinfo file and verify it in browser whether pagespeed is running or not. Alternatively we can check in terminal whether mod pagespeed working with apache or not. See below I have running latest stable release of pagespeed (1.9.32.13-0)
# curl -I localhost HTTP/1.1 200 OK Date: Sat, 05 Mar 2016 15:09:53 GMT Server: Apache/2.4.18 (Fedora) PHP/5.6.17 Accept-Ranges: bytes X-Mod-Pagespeed: 1.9.32.13-0 Cache-Control: max-age=0, no-cache Content-Type: text/html; charset=UTF-8
3) Enable/Disable the module
By default pagespeed module is enabled on Apache after installation. If you want to disable, you can do by editing the pagespeed.conf file.
[Enable pagespeed] # nano /etc/httpd/conf.d/pagespeed.conf ModPagespeed on [Disable pagespeed] ModPagespeed off
Keep smile..because your website is now 30-40% speed compare with earler…cool)