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.
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
Building from source is the always-available path — useful for a custom nginx build, an unsupported distribution, or a pinned nginx version. The from-source walkthrough compiles the maintained module against your nginx.
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. A license is required for production optimization: without a valid token, the worker stops optimizing and nginx passes requests through unmodified — your site keeps serving, just without PageSpeed rewrites.