Install mod_pagespeed module in cPanel

install mod_pagespeed module
install mod_pagespeed module

Install mod_pagespeed module in cPanel

The mod_pagespeed is one of one of the more recently popular modules for Apache. The mod_pagespeed is an open-source module that optimizes Web pages and their resources for better performance. It is an output filter for Apache and that can be configured through configuration files or a .htaccess file. This post helps you to install mod_pagespeed on cPanel server.

The main use of this module is to improve the website performance. This can be achieved by acting as an output filter for Apache. An “output filter” is a something that transforms the data before it’s sent to the client.

How to install mod_pagespeed module with EasyApache 3

The installation is very simple. A custom mod_pagespeed module is available for CPanel. It allows installation of mod_pagespeed via easyapache.

Installation Steps:

1. Clone the installation scripts onto the CPanel server.

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

2. Create

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

3. Login into the cPanel WHM > EasyApache and look for “mod_pagespeed” option. Alternatively, you can run the easyapache installer from command line (/scripts/easyapache).


Install mod_pagespeed with EasyApache 4

Create the file /etc/rpm/macros.apache2 using your favourite editor. I have using vim here.

vim /etc/rpm/macros.apache2

Add the following lines of code in it:

%_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

Then, run the following commands:

yum install rpm-build cpio ea-apache24-mod_version
cd /usr/local/src/
rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm
rpm -ivh /root/rpmbuild/RPMS/x86_64/ea-apache24-mod_pagespeed*.rpm

Restart Apache:

/etc/init.d/httpd restart

Verify the installation using following command:

httpd -M | grep pagespeed

Additional Information:

The below links will help you to Configure mod_pagespeed module.

For more information, see Google’s documentation.

If you like the post and wish to receive more articles from us, please like our FB page: Grepitout

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at


Click here to post a comment