I was looking for a simple way to install mod_pagespeed on a cPanel/WHM server with EasyApache4 (please note that with EasyApache3 you could have just added a custom mode to EasyApache and recompile apache with the new mode). Since EasyApache4 is strictly based on .rpm packages and there is no precompiled .rpm package for mod_pagespeed, you have to create your own .rpm package. After reading and inspecting a few blog posts I decided to write an article in case others might need this information.

Step 1) Download the pagespeed module from github.com repo

Step 2) Unizp the module

Step 3) Enter the EA4 mod_pagespeed folder

Step 4) Create a file that will take care of the RPM build errors (if you already tried to compile that module according to the instructions from github.com you probably know that RPM build process returns some errors and there is no .rpm package built at the end)

Step 5) Build the .rpm package

Step 6) Install the .rpm package

Step 7) Restart the apache web service

Step 8) Configure mod_pagespeed parameters
In order to do that, you have to edit the configuration file which is located at:

Have fun using Google Pagespeed module for Apache 2.4.x on a cPanel/WHM server with EasyApache4!

Note: I haven’t created this from scratch so I cannot assume the entire credit for this tutorial. Some steps were taken or inspired from other blog posts!


About Author

I am a linux passionate and currently working as a Linux Senior System Administrator. I also am a freelancer and help people to complete different jobs. You can hire me on Freelancer.com