Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
VGSources
Blog

How to Set Up mod_pagespeed With Apache on Ubuntu and Debian

A practical Debian and Ubuntu guide to installing mod_pagespeed 2.1 for Apache, checking pagespeed.conf and cache permissions, configuring scoped exceptions, and verifying optimization safely.
Length9 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install the native Apache package with the signed mod_pagespeed repository, then let the package provide both the Apache module and its optimizer-worker configuration. On a supported system, the essential sequence is:

curl -fsSL https://packages.modpagespeed.com/install.sh | sudo sh
sudo apt-get install mod-pagespeed
sudo systemctl restart apache2

The package enables the module and installs /etc/apache2/mods-available/pagespeed.conf. Open that file to confirm ModPagespeed on and a writable ModPagespeedFileCachePath, then verify responses with the X-Mod-Pagespeed header, cache MISS/HIT behavior, and the built-in administration and worker-health checks.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What mod_pagespeed installs

mod_pagespeed 2.1 is split into two cooperating pieces: an Apache module that runs in the web server and an optimizer worker that performs the heavier processing beside it. The Debian/Ubuntu package supplies the module, the default Apache configuration, and the wiring needed for Apache to communicate with that worker. You do not normally create a second service configuration just to make the native Apache installation work.

“mod_pagespeed 2.1 is one product in two parts: a module that runs inside your web server and an optimizer worker that does the heavy work beside it.”

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
modpagespeed.com documentation, 2026

On Debian and Ubuntu, Apache reads the package configuration from /etc/apache2/mods-available/pagespeed.conf. The minimum functional configuration is ModPagespeed on together with a writable ModPagespeedFileCachePath; the packaged file already defines both. Directives can be global or scoped to an individual virtual host, directory, URL location, or permitted .htaccess context.

Supported systems and prerequisites

The current signed-package baseline is specific. Confirm these requirements before changing your server:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Requirement Supported baseline Why it matters
Operating system Debian 12 or Debian 13; Ubuntu 22.04 or Ubuntu 24.04 The repository publishes packages for these releases.
Web server Apache 2.4 or newer The native module integrates with Apache 2.4+.
Privileges Root or an account able to use sudo Adding the repository, installing a package, editing Apache configuration, and restarting the service require administrative access.
Cache storage A path Apache can write to PageSpeed stores generated objects in the file cache; an unwritable path prevents normal operation.

If your distribution, release, or Apache version falls outside this matrix, do not assume that the commands below are supported. The package instructions cited here cover Debian 12/13 and Ubuntu 22.04/24.04 with Apache 2.4 or newer; a different platform may require another integration method or a separately maintained package.

Check the server before installation

  • Confirm the release from your normal operating-system inventory tools and ensure it is Debian 12/13 or Ubuntu 22.04/24.04.
  • Confirm that the site is served by Apache 2.4 or newer rather than nginx alone or a proxy that never passes requests to Apache.
  • Make sure you can obtain a root shell or run sudo.
  • Identify a filesystem location with enough free space and write permission for the PageSpeed cache. The package’s default path is already present in its configuration; change it only when you have a reason and have checked ownership and capacity.
  • Record your current Apache configuration and have a maintenance window available for the restart. PageSpeed changes take effect through Apache, so a restart is part of the activation process.

Install the signed Apache package

1. Add the official repository

Run the installation script supplied by the signed packages repository:

curl -fsSL https://packages.modpagespeed.com/install.sh | sudo sh

The script configures the apt source and its signing key. Using the repository is important because the next command depends on apt being able to locate a package matched to your supported Debian or Ubuntu release.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

2. Install mod_pagespeed

Install the package with apt:

sudo apt-get install mod-pagespeed

During installation, the package places the Apache module and a default pagespeed.conf in Apache’s module-configuration directory. It also supplies the settings that connect the module to the optimizer worker. You should not need to hand-build a worker command line for the standard native package.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Restart Apache

Activate the module and configuration by restarting Apache:

sudo systemctl restart apache2

A successful restart means Apache accepted the installed configuration and returned to service. If the restart fails, keep PageSpeed troubleshooting separate from unrelated virtual-host errors: first inspect the Apache error output and correct the reported syntax, path, or permission problem, then retry the restart.

Review pagespeed.conf before serving traffic

Open the package configuration:

/etc/apache2/mods-available/pagespeed.conf

The exact editor is your choice. The two settings that define the smallest working setup are:

ModPagespeed on
ModPagespeedFileCachePath /path/to/a/writable/cache

The packaged file already contains these directives with a package-selected cache location. Do not replace the cache path with a directory that Apache cannot write. If you move it, create the destination first, apply ownership and permissions appropriate to the account running Apache, and ensure the filesystem has room for generated assets. A path that exists but is read-only is functionally the same as a missing cache for PageSpeed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

The package also drops a default pagespeed.conf in Apache’s module configuration directory; edit that file to turn filters on. That file is the natural place to inspect global behavior, while narrower exceptions belong in the relevant Apache context.

Do you need a separate optimizer-worker configuration?

For the supported Debian and Ubuntu package, no additional worker setup is required for the basic deployment. The package includes the module-to-worker wiring. Treat the worker as a component that PageSpeed manages through the installed Apache configuration, not as an unrelated application that you must launch manually. If you have altered the packaged configuration, verify that the module still points to the worker settings supplied by the package before diagnosing a worker failure.

Choose the right configuration scope

Global settings apply to every Apache request handled by the installation. That is convenient for a single-site server, but a shared host often needs exceptions. The configuration reference permits PageSpeed directives in a virtual-host block, a <Directory> block, a <Location> block, and, where Apache permits it, .htaccess.

Global configuration

Keep ModPagespeed on and the cache-path directive in /etc/apache2/mods-available/pagespeed.conf when all sites should receive the same behavior. This is also the easiest arrangement to audit after package upgrades because the active defaults remain in one known file.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Per-virtual-host behavior

If one virtual host should be optimized and another should not, place an override in the affected virtual-host configuration. The principle is to leave the global default intact and scope the exception to the host that needs it. After editing, restart Apache so the new context is loaded.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Directory and URL-location exceptions

Use a <Directory> context for a filesystem tree and a <Location> context for a URL path. The configuration reference specifically allows ModPagespeed off in these contexts. This is useful for administrative interfaces, dynamically generated responses, or legacy paths that must bypass optimization while the rest of the site remains enabled.

<Location /path-that-must-bypass-optimization>
    ModPagespeed off
</Location>

The example shows the scope, not a universal path. Replace it with a real URL in your own virtual host and keep the exception as narrow as possible; disabling PageSpeed at a broad location also disables it for every child request under that path.

Using .htaccess

Directives may also be scoped in .htaccess when the Apache directory policy permits overrides. This can be practical when application owners cannot edit the virtual-host file, but it makes behavior harder to audit because settings are distributed through the document tree. Prefer the virtual-host or directory configuration when you control Apache centrally.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Verify that PageSpeed is working

Installation is not proof of optimization. Verify the response path from a client that reaches the Apache instance.

1. Check the response header

Request a page and inspect its headers:

curl -I http://localhost/

Look for the X-Mod-Pagespeed response header. Its presence identifies a response handled by mod_pagespeed. If you test through a reverse proxy or CDN, inspect the response at the layer that actually serves the request; an intermediary may remove or replace headers.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

2. Compare the first and second requests

Request the same page twice and compare the cache state reported in the response or diagnostic output. The first request should be able to populate the file cache, while a later request can show a cache MISS followed by a HIT once the generated result is available. This is an observation, not a guaranteed sequence for every resource: a changing URL, an uncachable response, an excluded location, or an empty cache can legitimately prevent a HIT.

3. Use the PageSpeed-off comparison

Append ?PageSpeed=off to a test URL to request the same resource with optimization disabled for that request. Compare the HTML, linked assets, and headers with the normal URL. The comparison helps distinguish an application response from a transformation introduced by PageSpeed; it is also a quick way to isolate a suspected optimization issue without changing the server-wide setting.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Open the global administration page

Inspect /pagespeed_global_admin from a suitably protected administrative path. The page provides operational information about filters, cache activity, and the running module. Do not expose an administrative endpoint publicly without applying the access controls required by your Apache setup.

5. Check worker health

When the header is absent or transformations stop, inspect the worker health endpoint provided by the installation as well as the administration page. A worker-health failure points to the module/worker side of the deployment; an absent header with healthy worker status more often indicates request routing, a scoped ModPagespeed off, or an intermediate proxy.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common failures

Symptom Likely area What to check
apt-get install mod-pagespeed cannot find the package Repository or platform mismatch Confirm that the install script completed, apt can read the signed source, and the host is Debian 12/13 or Ubuntu 22.04/24.04. The package is not established here for other releases.
Apache will not restart after editing Apache syntax or an invalid directive context Review the error emitted by Apache, check that the directive is inside a valid global, virtual-host, directory, location, or permitted .htaccess context, and restore the last known-good setting before retrying.
No X-Mod-Pagespeed header Request is not passing through the module Confirm the request reaches this Apache instance, the active configuration contains ModPagespeed on, and no narrower context sets ModPagespeed off. Check whether a proxy removed the header.
Cache never changes from MISS Cache path, request eligibility, or changing URLs Verify that ModPagespeedFileCachePath points to a writable location with free space. Test the identical URL twice, and account for responses that are deliberately excluded or not cacheable.
Worker-health check reports a failure Module-to-worker communication Review the package-provided wiring in pagespeed.conf, inspect the global administration page, and check Apache’s diagnostic output. Avoid inventing a separate worker launch command when using the native package.
Only one URL or site behaves differently Scoped configuration Search the virtual-host, <Directory>, <Location>, and .htaccess contexts for an override, especially ModPagespeed off.

Operational decisions and deployment alternatives

This guide covers the native Apache module because it is the supported path described by the Debian/Ubuntu package instructions. nginx and reverse-proxy deployments use a different integration boundary, and a separate optimizer-worker arrangement changes where configuration and health checks live. Do not copy Apache directives into an nginx configuration or assume that an Apache package’s paths apply to a proxy-only server.

Decision axis Native Apache package Other deployment style
Where optimization runs Apache module with the packaged optimizer-worker connection May run through nginx integration or a reverse proxy; configuration is different
Supported baseline covered here Debian 12/13 or Ubuntu 22.04/24.04; Apache 2.4+ Not established by the package facts in this guide
Installation model Signed apt repository and apt-get install mod-pagespeed May use another package or deployment process
Configuration scope Global file, virtual host, directory, location, or permitted .htaccess Depends on the web server and proxy configuration model
Performance evidence No authoritative percentage or speed benchmark is published in the referenced official pages Choose based on your architecture and measurements, not an assumed benchmark

The absence of a published benchmark matters: installation documentation establishes compatibility and operation, not a guaranteed percentage reduction in load time. Measure your own pages if you need a performance decision, and keep the normal-versus-PageSpeed=off comparison available while testing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A repeatable setup checklist

  1. Confirm Debian 12/13 or Ubuntu 22.04/24.04 and Apache 2.4 or newer.
  2. Confirm root or sudo access and identify a writable cache filesystem.
  3. Run curl -fsSL https://packages.modpagespeed.com/install.sh | sudo sh to configure the signed apt source and key.
  4. Run sudo apt-get install mod-pagespeed.
  5. Review /etc/apache2/mods-available/pagespeed.conf; verify ModPagespeed on and a writable ModPagespeedFileCachePath.
  6. Keep the package’s module-to-worker settings unless you have a documented reason to change them.
  7. Add only narrowly scoped exceptions for paths or virtual hosts that must bypass optimization.
  8. Run sudo systemctl restart apache2.
  9. Check a real response for X-Mod-Pagespeed, then repeat the request to observe MISS/HIT behavior.
  10. Use ?PageSpeed=off, /pagespeed_global_admin, and the worker-health endpoint when comparing or diagnosing behavior.

Bottom line

For a supported Debian or Ubuntu Apache server, mod_pagespeed setup is a package installation rather than a hand-built worker deployment. Add the signed repository, install mod-pagespeed, restart Apache, and verify the packaged configuration and writable cache. Keep exceptions scoped, protect the administration endpoint, and use headers, cache behavior, and the off-switch comparison to prove that requests are being optimized.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.