If you haven’t guessed it, this module directly complements Google’s PageSpeed Insights. It’s a great tool for giving you feedback on what can be done to optimize your site. What I’ve found is many of the issues this tool reports back to you can be resolved automatically by the PageSpeed module, Simply by installing it. Google can tell you what needs to be optimized and how to optimize it, so why not let them do it for you?
Combine/minify CSS & JavaScript
Flatten CSS @imports
Optimize images
Extend cache
Collapse Whitespace
Lazily Load Images
Move CSS to Head
Move CSS Above Scripts
Installation Procedure (CentOS):
- yum install rpm-build cpio ea-apache24-mod_version
- wget https://github.com/pagespeed/cpanel/raw/master/EA4/ea-apache24-mod_pagespeed-latest-stable.src.rpm
- rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm
- rpm -ivh /root/rpmbuild/RPMS/x86_64/ea-apache24-mod_pagespeed*.rpm
- /etc/init.d/httpd restart or service httpd restart
1- if you get following error on Step 3 :
"RPM build errors:
File must begin with "/": %{_httpd_moddir}/*.so
File must begin with "/": %{_httpd_modconfdir}/*.conf"
Just create a file named "macros.apache2" in '/etc/rpm/ directory and paste the below content into that and then restart from step 3.
%_httpd_mmn 20120211x8664
%_httpd_apxs /usr/bin/apxs
%_httpd_dir /etc/apache2
%_httpd_bindir %{_httpd_dir}/bin
%_httpd_modconfdir %{_httpd_dir}/conf.modules.d
%_httpd_confdir %{_httpd_dir}/conf.d
%_httpd_contentdir /usr/share/apache2
%_httpd_moddir /usr/lib64/apache2/modules
2- you may face following error:
"rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm
Installing ea-apache24-mod_pagespeed-latest-stable.src.rpm
error: ea-apache24-mod_pagespeed-latest-stable.src.rpm cannot be installed"
Just look at your screen , go 1 step back and check the downloaded file name in some case may be different most of people just run " rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm" command but sometimes file name can be different for example may be file saved as ea-apache24-mod_pagespeed-latest-stable.src.rpm.9 so in this case you should change file name in command before running that for above example just add .9 in end of command
rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm.9
Now Login into your WHM panel > Software > EasyApache4 and look for "mod_pagespeed" option and enable it after that restart apache again and run insight then check your website speed performance!
Configuring Google mod_pagespeed
The installation script will copy "pagespeed.conf" file into " /usr/local/apache/conf/ " or "/etc/apache2/conf.modules.d" on your server. Please consult the following pages to customize your mod_pagespeed configuration:mod_pagespeed module configuration
configuring mod_pagespeed filters