Install mod_pagespeed on CentOS with DirectAdmin installed

From the Google website:
“mod_pagespeed speeds up your site and reduces page load time. This open-source Apache HTTP server module automatically applies web performance best practices to pages, and associated assets (CSS, JavaScript, images) without requiring that you modify your existing content or workflow.”

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 tohttps://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 /root
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.

/etc/httpd/conf/extra/httpd-includes.conf
add this line: Include /etc/httpd/conf.d/pagespeed.conf

/etc/httpd/conf/httpd.conf
remove this line or comment it: Include conf/extra/httpd-deflate.conf

Make sure there is no ‘setoutputfilter’ line in your .htaccess file, this will interfere with mod_pagespeed.

Now restart httpd and see if you’ve got the module loaded:


service httpd restart
apachectl -t -D DUMP_MODULES

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

 

You can also change the path of Image caching and Memcache server in conf file

vi /etc/httpd/conf.d/pagespeed.conf

Line 38: ModPagespeedFileCachePath            ”/var/cache/mod_pagespeed/”

Line 42: ModPagespeedMemcachedServers 127.0.0.1:11211

 

Categories: Apache, linux

Comments are closed.