Mod_Pagespeed is an open source web performance module designed to work with Apache and Nginx servers. This excellent tool has been out for a few years now, but it wasn’t until last year that it became stable enough to start using it on cPanel servers.
Main mod_pagespeed optimization filters
- Image optimization, compression and resizing
- Cache extension, domain sharding, and domain rewriting
Before starting this mod_pagespeed tutorial, it’s important to watch the introductory video below. This will show you how mod_pagespeed works. It will also give you a series of best practices and examples you can apply to your websites.
Now that you have an idea of what the module is and how it can help, let’s go over the technical stuff.
Installing mod_pagespeed on cPanel servers
Login to your shell terminal as root, then use git to clone the installation script into your cPanel server.
/usr/local/cpanel/3rdparty/bin/git clone https://github.com/pagespeed/cpanel.git /tmp/pagespeed
Next step: Create the Speed.pm.tar.gz file, necessary for the pagespeed compilation.
Move to your tmp folder, untar and move speed.pm into EasyApache custom modules directory.
cd /tmp/pagespeed/Easy tar -zcvf Speed.pm.tar.gz pagespeed mkdir -p /var/cpanel/easy/apache/custom_opt_mods/Cpanel/Easy mv Speed.pm Speed.pm.tar.gz -t /var/cpanel/easy/apache/custom_opt_mods/Cpanel/Easy/ cd && rm -rf /tmp/pagespeed
Login into your WHM > EasyApache interface and take a look at the mod_pageseed section. You should be able to start running the EasyApache process with mod_pagespeed enabled from WHM panel. Otherwise you can always run /scripts/easyapache from commmand line, which is usually more stable than the browser version. Configure PHP and Apache server as you wish and then restart http server to apply the changes:
At this point you should have mod_pagespeed up and running on your cPanel server.
How can I Configure mod_pagespeed for cPanel?
EasyApache installation helps install the mod_pagespeed module with basic configurations. When compiling, you may need to tune up your mod_pagespeed configuration to fit your needs. You can find the default pagespeed.conf file at /usr/local/apache/conf/ on your cPanel server.
Here’s a basic configuration example:
How to test if mod_pagespeed is working
It’s easy! Just run a curl command against your website. For example:
curl -I http://www.yourwebsite.com
Which should show you something like this:
HTTP/1.1 200 OK Date: Sat, 31 Jan 2014 06:58:03 GMT Server: Apache X-Mod-Pagespeed: 126.96.36.199-4321 Cache-Control: max-age=0, no-cache Vary: Accept-Encoding Connection: close Content-Type: text/html
If mod_pagespeed for cPanel is working, you should see the “X-Mod-Pagespeed” version loaded in your web page headers.
As web performance is becoming more and more important every day, you should never forget about this great piece of software from Google.
Want to learn more? Read more about mod_pagespeed in these places:
Have you tried mod_pagespeed? What are your impressions and thoughts? Did it improve your web performance? Let us know in the comments section below.
Popular search terms:
- configure pagespeed cpanel
- enable gzip compression
- how to find if pagespeed is installed on my shared server
- how to install mod_pagespeed in cpanel server