Apr 14, 2016
cPanel Access Level
Root Administrator
Adding mod_pagespeed in ea4 has been a feature request for years now so I thought to create a thread and as a community figure out how to install mod_pagespeed on our servers and most importantly, configure it.

So to install it you need to run the following on a root ssh:
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
That will install and enable mod_pagespeed on Apache 2.4 and above.

However, default configuration might cause all sorts of problems like excessive resource usage on the server, hogging up php-fpm pools etc. So the first thing I suggest you do is go on the PageSpeed config and disable it globally. You can enable it on a per domain or per subdomain basis using .htaccess or specific configurations for each account.

So to disable mod_PageSpeed globally you should do the following:
first make a backup copy of the default pagespeed configuration file:
cp /etc/apache2/conf.modules.d/456_pagespeed.conf /etc/apache2/conf.modules.d/456_pagespeed.conf.backup
Then go ahead and edit it:
nano /etc/apache2/conf.modules.d/456_pagespeed.conf
I use nano as editor but you may want to use vi or another one of your choice.

In there add the following:
<IfModule pagespeed_module>
ModPagespeed off
ModPagespeedFileCachePath "/var/mod_pagespeed/cache/default/"
ModpagespeedLogDir /var/log/pagespeed/default/
ModPagespeedMessageBufferSize 100000
ModPagespeedEnableCachePurge on
The <IfModule pagespeed_module> section is in the default config file and you need to change ModPageSpeed value to off and optionally change the value ModPagespeedFileCachePath

ModpagespeedLogDir, ModPagespeedMessageBufferSize and ModPagespeedEnableCachePurge are not set by default so you should add them. They will help a lot later.

Don't forget to restart httpd:

systemctl restart httpd
After that, mod_pagespeed is installed on the server and you can easily enable it on any domain by simply adding the following to it's .htaccess file:
<IfModule pagespeed_module>
  ModPagespeed on

Ok, so that basically is a good way to get started with installing and configuring mod_pagespeed.
Up till here, I'm fine but I'm having a problem completing some other steps.

  1. Configure it with nginx. I use enginetron to implement nginx on my cpanel server (which I believe is the most common way to add nginx to a cpanel server) and mod_pagespeed has to be properly configured to run with nginx. Any attempt I made to change nginx config files to take advantage of mod_pagespeed resulted in errors. So I need a contribution to actually make it work.
  2. Enable the PageSpeed admin Console. That would be great. The guide here: webhostinghero.com/blog/cpanel-modpagespeed-installation/ does not help a lot. I suppose it's more of a general guide and not cpanel specific. Many thanks to the guys at webhostinghero for providing though. The first steps helped a lot.
So Hopefully we can improve on the steps above and complete the guide with the help of the rest of the community. Having a spot to actually find all information on mod_pagespeed in cpanel is very useful I believe. This info is right now all over the place in bits and parts.

When this guide is complete I will add [guide] at the title.
Last edited by a moderator:


Staff member
Apr 11, 2011
Hello @Alexandros Androutsos,

Thank you for sharing your installation instructions. Note that while the inclusion of a stable PageSpeed module in EasyApache 4 is not yet available, we do have an experimental RPM you can test. Information about how to install it is found on the corresponding feature request page:

Add support for mod_pagespeed to easyapache4

I'll leave this thread open for user-feedback regarding your Nginx and admin console steps.

Thank you.