Install ngx_pagespeed for nginx
Install the maintained PageSpeed module for nginx from a signed repository, or build it from source. The module is free to install and evaluate; a license is required for production optimization.
Install from the signed repository
Add the We-Amp signed apt/yum repository, then install the module with your distribution's package manager. The packages are signed by a repository We-Amp operates.
# Add the signed repository curl -fsSL https://packages.modpagespeed.com/install.sh | sudo sh # Install the nginx module sudo apt install nginx-module-pagespeed # Debian/Ubuntu sudo dnf install nginx-module-pagespeed # AlmaLinux/RHEL
After installing, load the module, add a minimal pagespeed
configuration, and reload nginx. The
configuration reference covers the directives
you need to get optimization running.
Per-distribution guides
Step-by-step install commands for each supported distribution: Ubuntu, Debian, AlmaLinux, Rocky Linux, RHEL, and Amazon Linux.
Signed packages cover Debian 11, 12, and 13 and Ubuntu 22.04 and 24.04 on amd64 and arm64; AlmaLinux, RHEL, and Rocky Linux 9 on x86_64 and aarch64, and 10 on x86_64.
Verify it is running
Once nginx is reloaded with the module enabled, an optimized response
carries the X-Page-Speed header:
curl -sI https://yoursite/ | grep -i x-page-speed
A version string in that header means the worker is optimizing. If the
header is absent, check that the module is loaded and
pagespeed on; is set — the
configuration reference walks through it.
Build from source
The maintained module ships prebuilt, so there's rarely a reason to compile. If you want to build the legacy open-source module yourself — for parity with an existing upstream deployment — the walkthrough covers it.
Build ngx_pagespeed from sourceAlso running Apache?
The maintained Apache module installs from the same signed repository
under the package name mod-pagespeed:
sudo apt install mod-pagespeed # Debian/Ubuntu sudo dnf install mod-pagespeed # AlmaLinux/RHEL
1.1 nginx or 2.0 nginx?
There are two maintained PageSpeed engines for nginx, built for two situations:
mod_pagespeed 1.1
The drop-in continuation of the open-source module. Keeps the
existing pagespeed_* directive surface, so existing
configuration carries over.
ModPageSpeed 2.0
The new architecture — zero-copy mmap serving, variant-aware caching, and AVIF output. Built for new installs that want the modern engine.
Neither is "the old one." Pick by your situation: an existing configuration to preserve points to 1.1; a fresh install that wants the modern engine points to 2.0. The full side-by-side comparison lives on modpagespeed.com.
Compare mod_pagespeed 1.1 vs 2.0 for nginxLicensing
The module is free to install and evaluate — it fully optimizes and
adds an X-PageSpeed-Warn: unlicensed header until a
license is applied. A commercial license is required for production
use; your site keeps serving either way.