Loading...

Knowledge Base

mod_pagespeed Module for Faster Page Load on VPS Servers

mod_pagespeed is an Apache module from Google that rewrites web pages as Apache serves them, which cuts latency and bandwidth and helps pages load faster. On a HostGator VPS or Dedicated server that runs cPanel and WHM, you can install it yourself from EasyApache 4 in WHM. It takes a few clicks, and you don’t have to edit any Apache files afterward.

This article covers the install steps, a quick way to confirm the module is running, and what to check if a domain also uses Cloudflare.

What You Need Before Installing mod_pagespeed

You need three things in place before you start:

  • Root access to WHM. Only the root user can add Apache modules.
  • EasyApache 4. mod_pagespeed ships as an EasyApache 4 module, and EasyApache 4 is what current cPanel and WHM servers use.
  • mod_deflate. It’s already installed on a standard EasyApache 4 server, so there’s nothing to compile first.

How to Install mod_pagespeed in WHM

  1. Log in to your Customer Portal.
  2. From the left-hand menu, navigate to Hosting and select My Plans.
  3. Click the WHM button.

    HostGator Hosting Tab Manage Button
     

  1. In the search box at the top of the left menu, type EasyApache 4, then click EasyApache 4 under Software.

    WHM search box with EasyApache 4 typed and the EasyApache 4 result listed under Software

  2. In the Currently Installed Packages section, click Customize.

    EasyApache 4 page with the Customize button highlighted in the Currently Installed Packages section

  3. In the left menu, click Apache Modules.

    EasyApache 4 left menu with Apache Modules highlighted

  4. In the Search box, type pagespeed.
  5. Turn on the toggle next to mod_pagespeed.

    Apache Modules page with pagespeed typed in the Search box and the mod_pagespeed toggle turned on

  6. In the left menu, click Review. Confirm that mod_pagespeed appears in the list of packages to install.

    EasyApache 4 Review page listing mod_pagespeed under the packages to install

  7. Click Provision.

    EasyApache 4 Review page with the Provision button highlighted

  8. Wait for the process to finish. When you see The provision process is complete., click Done.

    EasyApache 4 message reading The provision process is complete with the Done button

Success: When provisioning finishes, mod_pagespeed is installed and running. You don’t need to touch any Apache configuration files.
Note: The module turns on for every domain on the server as soon as it’s installed, not just one site.

How to Check That mod_pagespeed Is Running

The quickest way to check is the terminal built into WHM, so you don’t need a separate SSH client.

  1. In WHM, type Terminal in the search box at the top of the left menu, then click Terminal under Server Configuration.
  2. If a warning notice appears, click I understand and want to proceed.
  3. In the terminal window, run this command to see whether Apache loaded the module:
    httpd -M | grep pagespeed

If it did, you’ll get this back:

pagespeed_module (shared)

To confirm that pages are actually being processed, run the next command in the same terminal window and look at the response headers. Swap yourdomain.com for a domain hosted on the server:

curl -s -D - -o /dev/null -H "Host: yourdomain.com" http://127.0.0.1/ | grep -i pagespeed

A working install adds an X-Mod-Pagespeed header to the response. Your version number may be different:

X-Mod-Pagespeed: 1.13.35.2-0

Which Files mod_pagespeed Adds to Your Server

The EasyApache 4 package adds one configuration file that loads the module and switches it on, plus the module files and a cache directory. That’s why no manual Apache edits are needed.

Files and default settings for mod_pagespeed
Item Location or default
Configuration file /etc/apache2/conf.modules.d/510_pagespeed.conf
Module file (Apache 2.4) /usr/lib64/apache2/modules/mod_pagespeed_ap24.so
Cache directory /var/mod_pagespeed/cache/
Default status On for all domains (ModPagespeed on)
Excluded by default cPanel subdomains

The configuration file also lists commented-out options for the rewrite level, individual filters, and cache sizes. Most sites never need to change them.

Does mod_pagespeed Work with Cloudflare?

Sometimes it runs into trouble. Cloudflare and mod_pagespeed can both optimize or compress website content, so a domain that uses both may show display or loading problems after you install the module. If that happens, turn off the overlapping optimization features for that domain in your Cloudflare dashboard and test the site again. If the problem is still there, contact HostGator Support.

Frequently Asked Questions

Q: Can I install mod_pagespeed on EasyApache 4?
A: Yes. It’s listed under Apache Modules in WHM and installs like any other EasyApache 4 module.
Q: Do I have to edit an Apache configuration file after installing it?
A: No. The install adds its own configuration file that loads and turns on the module. The extra options inside that file are optional.
Q: Do I need to compile mod_deflate first?
A: Not on a standard EasyApache 4 server. mod_deflate is already installed.
Q: Will mod_pagespeed run on all of my domains?
A: Yes. Once it’s installed, it’s on server-wide by default.
Please contact us via phone or chat if you have any questions or require assistance.

Loading...