Install google page on linux centos server

After adding few of tutorials about PHP optimizers like Memcached, XCache and PHP eAccelerator. Which are used to optimize php scripts by caching them in compiled state. This article is used for optimizing Apache using mod_pagespeed module.

Features of mod_pagespeed
  • Automatic website and asset optimization
  • Latest web optimization techniques
  • 40+ configurable optimization filters
  • Free, open-source, and frequently updated
  • Deployed by individual sites, hosting providers, CDNs

This article will help you to how to install mod_pagespeed Apache module on CentOS, RHEL and Fedora systems.

Step 1: Add Required Yum Repository

mode-pagespeed rpms are available under Google mod-pagespeed yum repository. Add the below repository in your system.

# vim /etc/yum.repos.d/google-mode-pagespeed.repo
Step 2: Install mode-pagespeed

After adding google repository, install mode-pagespeed package using following command.

# yum install mod-pagespeed
Module mode-pagespeed files
  • /etc/httpd/conf.d/pagespeed.conf : Main configuration file for Apache.
  • /usr/lib/httpd/modules/ : module for Apache.
  • /var/www/mod_pagespeed/cache : Directory used to File caching
Enable/Disable module in Apache

By default mod_pagespeed module are enabled, If you want to change it, edit mod_pagespeed apache configuration file and find below switch and make it on or off

ModPagespeed on
ModPagespeed off
Step 3: Verify Module

The default installation setting are fine to use mod_pagespeed module. Now create a php info file under document root of you website and add following content.

# vim /var/www/html/info.php

Access info.php file in browser and search for content highlighted in below screen-shot.


Go on virtual host  in httpd.conf


<VirtualHost *:80>
DocumentRoot “/var/www/html/example/”
<Directory “/var/www/html/”>
AllowOverride All
Order allow,deny
Allow from all
ModPagespeedDisallow “*/phpmyadmin/*”
ModPagespeedEnableFilters defer_javascript
ErrorLog /var/log/mergingbranch-error_log
CustomLog /var/log/mergingbranch-access_log common
RewriteEngine on
RewriteRule ^(.+)\.([\d]*)\.(js|css)$ $1.$3
# RewriteEngine on
#RewriteCond %{ENV:HTTPS} !on [NC]
#RewriteRule ^(.*?)\/(.*)$$2 [R=301,L]