Install mod_pagespeed for Apache on CentOS

google-page-speedPageSpeed speeds up your site and reduces page load time. This open-source webserver 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. This tutorial help install mod_pagespeed for Apache on CentOS server.

Install mod_pagespeed

  • For 64-bit OS: [bash]wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm[/bash]
  • For 32-bit OS:[bash]wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_i386.rpm[/bash]
  • Install:[bash]rpm -U mod-pagespeed-*.rpm[/bash]
  • Restart service: [bash]service httpd restart[/bash]
  • How to see if mod_pagespeed is enabled in current website? -> Check response header to see if there is “X-Mod-Pagespeed”

Configuration

  • The according configuration file is located at [bash]/etc/httpd/conf.d/[/bash]
  • To turn on/off: [bash]ModPagespeed on[/bash]
  • By default, mod_pagespeed rewrites everything it can. We can disable certain files (javascript for example) from being rewritten with the following directive: [bash]ModPagespeedDisallow "*/jquery-ui-*.min.js"[/bash]

Leave a Reply