How to install mod_pagespeed in cPanel Servers
Mod_pagespeed is an effective way of speeding up the delivery of your website to your visitors. Originally released by Google it’s now maintained by an open community and you can easily deploy this to any cPanel server. we’ve created some tests as shown below to demonstrate just how much mod_pagespeed can speed up your website. Install Mod_PageSpeed on cPanel servers with Easy Apache 4.
As you can see the bottom two reports on https://www.first2host.co.uk are done with mod_pagespeed removed from the server, the YSLOW rating is 77% and the PAGESPEED is 80. But when deploying mod_pagespeed to the cPanel server we see an increase to 83% and 82% respectively. The loading time is now at 3.15s. Mod_PageSpeed can help with your Monthly Website SEO.
How to install mod_pagespeed cPanel EasyApache 4
Create the file /etc/rpm/macros.apache2 and add the following lines of code exactly as below
nano /etc/rpm/macros.apache2
%_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
Next, to install Mod_PageSpeed in cPanel run the following commands in order, make sure you run each command on its own
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
Mod_PageSpeed will now be installed on your cPanel server. In the header of any website on the server, you will now see the page speed tag.