Install Google Mod_Pagespeed on CentOS with DirectAdmin

Google released an open source Apache module to simplify the optimization of your content. The module, mod_pagespeed, will do all sorts of magic like minify your JS/CSS and optimize images, and a handful of other optimizations that seem (from limited testing) to improve your servers performance considerably.

First see how your site is doing right now, when you are done with the mod_pagespeed installation you can do another test to see if you have improved. Go to https://developers.google.com/speed/pagespeed/insights and check your score and remember it!

So if you want to install mod_pagespeed, follow this procedure (64-bit):

cd ~
yum install at
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm

We have to install it with dependency check disabled, because with DirectAdmin httpd is installed from source:

rpm -i --nodeps mod-pagespeed-stable_current_x86_64.rpm

Now we have to edit some files.

Open file: /etc/httpd/conf/extra/httpd-includes.conf and add this line:

#Google PageSpeed Module
Include /etc/httpd/conf.d/pagespeed.conf

Open file: /etc/httpd/conf/httpd.conf and remove this line or comment it:

Include conf/extra/httpd-deflate.conf

If you’d like to change the options for PageSpeed, it’s configuration file is located in /etc/httpd/conf.d/pagespeed.conf.

Once everything is set, we’ll need to restart Apache and test to see if the module loaded properly:

service httpd restart

and

apachectl -t -D DUMP_MODULES

Check if you see “pagespeed_module (shared)” loaded.

Mod Pagespeed is loaded

Mod_Pagespeed is loaded

Now check if your site has indeed speeded up.

You should also check any .htaccess files you may use and remove any instances of ‘setoutputfilter’ as this will probably override what mod_pagespeed is doing.

There you have it! Load up a copy of FireFox with the PageSpeed installed and check out how your score has improved. In my case, with all other caching disabled, I went from a score of 67 to an 84. Not a bad improvement if you ask me!

4
Leave a Reply

avatar
3 Comment threads
1 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
4 Comment authors
NorvDanvarmaMarijn Recent comment authors
  Subscribe  
Notify of
Marijn
Guest
Marijn

Thanks a lot!

varma
Guest
varma

Really thanks for the great guide, i was looking for a way to install mod_pagespeed on existing server setup.
Also can you help me with installing it on a Nginx+Apache server (Directadmin with latest custom build). I think here the Nginx mod pagespeed service need to be loaded. Can you help me with that.

Dan
Guest

Hi,

I just found the following tutorial https://vpsineu.com/blog/install-configure-nginx-pagespeed-module-directadmin-linux-vps/ on how to setup PageSpeed with Nginx on DirectAdmin VPS which actually works. I’ve done it on one of my DirectAdmin servers and it greatly improved the performance of the websites.

Hope it helps,

— Dan

Norv
Guest

Hi, sometimes I see a 503 site error when I arrive at your webpage. Just a heads up, best wishes