How to install mod_pagespeed on a WHM / cPanel server

How to install mod_pagespeed on a WHM / cPanel server

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 content.

As you can see the bottom two reports on https://www.first2host 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 server we see an increase to 83% and 82% respectively. The loading time now at 3.15s.


How to install mod_pagespeed using Easy Apache 3

 No one should be using Easy Apache 3 anymore. If you are upgrade to Easy Apache 4

/usr/local/cpanel/3rdparty/bin/git clone /tmp/pagespeed/

cd /tmp/pagespeed/Easy
tar -zcvf pagespeed
mkdir -p /var/cpanel/easy/apache/custom_opt_mods/Cpanel/Easy
mv -t /var/cpanel/easy/apache/custom_opt_mods/Cpanel/Easy/
cd && rm -rf /tmp/pagespeed

Install Mod_Pagespeed


Once complete you can then run EasyApache to compile mod_pagespeed into your server.


Free cPanel VPS License on Intel Xeon E5-2630v3 KVM and OpenVZ SATA and SSD VPS Servers


How to install mod_pagespeed using Easy Apache 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, run the following commands in order, make sure you run each command on its own

yum install rpm-build cpio ea-apache24-mod_version
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


Our Products

Try our super fast Linux SSD Servers for a real performance increase when serving your websites to your visitors. Ask us on live chat or by a ticket to see how we can help you skyrocket your response times. We have IPs in 14 countries worldwide which we can route to our customer’s services to give your local Google search rankings a real boost.

How was this article?

How to install mod_pagespeed on a WHM / cPanel server
232 5 100%
cPanel VPS Server

cPanel Dedicated Servers VPS Servers

Select Language
SSD NVMe VPS Server With Free cPanel License ★ 70% Faster Than SATA Storage ★ 30% Faster Than SSD Storage ★ 14 LocationsInstant Deployment