• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

Install pagespeed module ( mod_pagespeed ) on Apache Web Server : CentOS / RHEL

July 30, 2014 by Sharad Chhetri 8 Comments

The opensource pagespeed module ( mod_pagespeed ) is widely used for speed up the websites. Pagespeed module is available for Apache and Nginx . Currently, to list your website on google top search page , your site must be opened quickly. Hence, speed matters for user end experience also. Now a days, users do not want to visit the website which opens very late.

In this tutorial, we are doing this practical on Apache web server.

Note: The tutorial is applicable to Apache version 2.2 and 2.4 both

Install pagespeed module ( mod_pagespeed ) on Apache Web Server

Follow the given below steps to install mod_pagespeed on Apache web server. At the time of writing this post, the pagespeed module is applicable to Apache version 2.2 and 2.4 .

Download Pagespeed Module

We will use wget command to download the latest Pagespeed module.
You can skip the below given command if you have wget command available on system

yum install wget

As per your Operating system architecture.Download the below given rpm package.

For 64 bit Operating System architecture(x86_64), Download

wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm

For 32 bit Operating System architecture(i386), Download

wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_i386.rpm

Install rpm package

Install the downloaded mod-pagespeed rpm package . (Actually it is yum repo package)

rpm -ivh mod-pagespeed-*.rpm 

After this installation, new yum repo file will be created in /etc/yum.repos.d

Check the repo file content by using cat command

cat /etc/yum.repos.d/mod-pagespeed.repo

The below given is reference from our server.Do not copy paste.

[root@webserver ~]# cat /etc/yum.repos.d/mod-pagespeed.repo 
[mod-pagespeed]
name=mod-pagespeed
baseurl=http://dl.google.com/linux/mod-pagespeed/rpm/stable/x86_64
enabled=1
gpgcheck=1
[root@webserver ~]#

Install pagespeed module with yum command

Now use yum command to install pagespeed module.

yum install mod-pagespeed

Check the at command also in your system. If it is not available then use yum command to install at

yum install at

Now, page speed module is installed. And you can check

Two conf file is also created inside /etc/httpd/conf.d
1. /etc/httpd/conf.d/pagespeed.conf (Main configuration file)
2. /etc/httpd/conf.d/pagespeed_libraries.conf

Two pagespeed modules liberary are installed
1./etc/httpd/modules/mod_pagespeed_ap24.so
2. /etc/httpd/modules/mod_pagespeed.so

One file created in /etc/cron.daily/
1. /etc/cron.daily/mod-pagespeed

Restart Apache Service

After installing the pagespeed module restart the Apache service

service httpd restart

Enable/Disable the module

By default, after installation pagespeed module is enabled. The value of ModPagespeed in file /etc/httpd/conf.d/pagespeed.conf decide status of Pagespeed Module

To enable the pagespeed module

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

To disable the pagespeed module

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

Note: After editing, do not forget to restart the apache service to make module status effective (service httpd restart)

Verify PageSpeed is running

1. The best way to verify the Pagespeed is running by checking the HTTP response error
Replace example.com with your website address

curl -I http://example.com

Find X-Mod-Pagespeed in HTTP Header, it confirms pagespeed is running

We have installed mod_pagespeed on our server. See the below given reference

pagespeed module

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. How to install Apache Web Server on Ubuntu 14.04 LTS (Trusty Tahr)
  2. How to set htdigest password in apache web server
  3. How to create VirtualHost in Apache Web Server
  4. Find installed and enabled apache module in Debian/Ubuntu
  5. ERROR: Module rewrite does not exist
  6. How to install apache webserver in CentOS and Red Hat
  7. Remove python module installed from source code on Linux
  8. How to install and remove Apache webserver in Ubuntu and Debian
  9. How to install mod_proxy and setup reverse proxy in Apache Ubuntu
  10. How to install mod_fcgid on CentOS and RHEL

Filed Under: Apache, Linux Tagged With: apache, pagespeed

Reader Interactions

Comments

  1. Nirjonadda says

    February 26, 2017 at 3:13 pm

    Please let me know that does this steps still are work on Centos 7 with cPanel using EasyApache 4?

    Reply
  2. clasificados cuba says

    October 21, 2016 at 1:14 am

    What can I do with this error:

    root@vps [~]# yum install at
    Loaded plugins: fastestmirror, presto, tsflags, universal-hooks
    Setting up Install Process
    Loading mirror speeds from cached hostfile
    * EA4: 208.100.0.204
    * base: mirror.steadfast.net
    * extras: bay.uchicago.edu
    * updates: mirror.solarvps.com
    Package at-3.1.10-48.el6.x86_64 already installed and latest version
    Nothing to do
    root@vps [~]# wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm
    –2016-10-20 21:11:39– https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm
    Resolving dl-ssl.google.com… 173.194.198.136, 173.194.198.190, 173.194.198.93, …
    Connecting to dl-ssl.google.com|173.194.198.136|:443… connected.
    HTTP request sent, awaiting response… 200 OK
    Length: 6635260 (6.3M) [application/x-redhat-package-manager]
    Saving to: “mod-pagespeed-stable_current_x86_64.rpm”
    100%[====================================================================================================================================================================================================================================>] 6,635,260 3.11M/s in 2.0s
    2016-10-20 21:11:41 (3.11 MB/s) – “mod-pagespeed-stable_current_x86_64.rpm” saved [6635260/6635260]
    root@vps [~]# rpm -ivh mod-pagespeed-*.rpm
    warning: mod-pagespeed-beta_current_x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 7fac5991: NOKEY
    error: Failed dependencies:
    httpd >= 2.2 is needed by mod-pagespeed-beta-1.11.33.4-0.x86_64
    mod-pagespeed-stable conflicts with mod-pagespeed-beta-1.11.33.4-0.x86_64
    httpd >= 2.2 is needed by mod-pagespeed-stable-1.11.33.4-0.x86_64
    mod-pagespeed-beta conflicts with mod-pagespeed-stable-1.11.33.4-0.x86_64

    Reply
  3. Rudra says

    May 14, 2015 at 1:46 pm

    @Vishalshah: google’s pagespeed module (mod_pagespeed) is the most powerful web optimization toolkit. But it takes a little time to understand how to use the filters. I believe going through this link will help you https://developers.google.com/speed/pagespeed/module/configuration

    @Sharad: Yet again a nice post 🙂

    Reply
    • sharad chhetri says

      May 15, 2015 at 4:27 pm

      Thank You Rudra,

      Cheers!
      Sharad

      Reply
  4. vishalshah says

    May 12, 2015 at 2:01 am

    Dear Sharad

    Dear Team

    I tried to follow instructions mentioned in your blog to install mod_pagespeed.

    After appying all the filters, I still can not see that .jpg are not converted into wbnp . Moreover, CSS and JS are still same and they are not optimized.

    I am using AWS – EC 2 t2.medium instance [Server: Apache/2.2.15 (CentOS)].

    Here is url where i tried to follow your instructions.

    https://www.example.com/sample.html

    [root@ip- conf.d]# curl -I https://www.example.com
    HTTP/1.1 200 OK
    Date: Tue, 12 May 2015 01:56:51 GMT
    Server: Apache/2.2.15 (CentOS)
    Vary: Accept-Encoding
    Cache-Control: max-age=0, no-cache
    Connection: close
    Content-Type: text/html; charset=UTF-8

    Would you help me to understand how can i enable mod_pagespeed or why filters are not working.

    Thanks

    Reply
    • sharad chhetri says

      May 12, 2015 at 2:25 am

      Check header module in your Apache config file, response header is hidden .Hence, not showing with “curl -I”
      Pagespeed is there in your website, I checked with firebug.
      Pagespeed

      Note: I have renamed the URL which you have given because of security reason.

      Reply
  5. Muhaimin says

    December 4, 2014 at 4:59 am

    please update if this compatible with CentOs 7?

    Reply
    • sharad chhetri says

      December 4, 2014 at 6:04 am

      Thankyou Muhaimin,

      We will update it soon.

      Regards
      Sharad

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

4 Different commands to find system uptime in linux

df command not showing correct free space in linux

error could not configure a c compiler Linux

Run the script using nohup without hitting enter key two times

send email after mysql backup through bash script in simple way

safest method to remove softlink in linux

How to see system load average in terminal with graphical representation

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ·
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy