ngx_pagespeed alternative
ngx_pagespeed was the nginx port of Google's mod_pagespeed — a dynamic module that did image transcoding,
CSS and JS minification, and HTML rewriting inside the nginx request path. Released 2013. Google
donated the project to the Apache Software Foundation in 2017; the GitHub repositories were
marked read-only in 2025 after the Apache Incubator podling retired in 2023.
The archived binaries at apache/incubator-pagespeed-ngx still build against nginx 1.16. They don't build cleanly against nginx 1.26+, don't support AVIF, don't emit Core Web Vitals telemetry, and have not received a security patch in years.
If you're looking for an ngx_pagespeed replacement, ModPageSpeed 2.0 is the
nginx-first continuation. Same optimization libraries, new architecture, designed for nginx
from the ground up.
What ngx_pagespeed actually was
ngx_pagespeed ran the optimization libraries inline in the nginx worker. The
pagespeed_rewriter_global_options directive bag, the
RewriteLevel filter selectors, the URL-based variant fan-out — all the same
primitives as the Apache module, ported to nginx's filter chain.
That design was state-of-the-art in 2012. It also coupled optimization work to the request path, which limited how much real work could happen without blocking response latency.
Why move off it
| Symptom | Reason |
|---|---|
| Builds fail against nginx 1.26+ | Unmaintained ABI compatibility |
| AVIF not supported | Format support frozen at WebP era |
| LCP/INP not measured | No Core Web Vitals telemetry hooks |
libwebp/libpng CVEs unpatched | No active maintainer applying fixes |
pagespeed_rewriter_global_options triggers segfaults under high concurrency
| Known issue, never fixed |
ModPageSpeed 2.0 — nginx-first by design
The 2.0 architecture moves optimization work out of the nginx request path. Nginx intercepts
the request, checks the cache, serves the variant via zero-copy mmap on a hit.
On a miss, it serves the original and notifies a separate worker process. The worker decodes
once, generates up to 36 variants per asset (WebP, AVIF, three viewport sizes, two pixel
densities, save-data), writes them back to the cache. The next request hits.
# /etc/nginx/conf.d/pagespeed.conf
load_module modules/ngx_modpagespeed.so;
pagespeed {
cache_path /var/cache/modpagespeed;
worker_socket /run/modpagespeed.sock;
} # Docker Compose
curl -fsSL https://get.modpagespeed.com | sh
docker compose up -d The optimization libraries are the same ones that served billions of pages through ngx_pagespeed. The architecture around them is new.
2.0 or 1.1 for nginx
| Use case | Choose |
|---|---|
| New nginx install, want modern architecture and AVIF | ModPageSpeed 2.0 |
| Existing ngx_pagespeed config you want to keep working | mod_pagespeed 1.1 (nginx port) |
| Want zero-copy serving + variant-aware caching | ModPageSpeed 2.0 |
Need the exact pagespeed_* directive surface from 2012 | mod_pagespeed 1.1 |
| Apache, IIS, or Envoy in the same stack | mod_pagespeed 1.1 |
Migration
ngx_pagespeed configurations don't carry over directly to 2.0 — the directive
surface is intentionally smaller and the rewriting model is different. For a drop-in upgrade
that keeps your existing config, install mod_pagespeed 1.1 from
packages.modpagespeed.com.
For a re-architecture onto 2.0, the migration notes from the 1.x era cover the conceptual shift — what stays, what changes, and how the worker model differs from inline rewriting.
Frequently asked questions
Is ngx_pagespeed still maintained?
No. Google donated the project to the Apache Software Foundation in 2017. The Apache Incubator podling retired in 2023, and the GitHub repositories were marked read-only in 2025. apache/incubator-pagespeed-ngx is now read-only.
What replaced ngx_pagespeed for nginx?
ModPageSpeed 2.0 is the nginx-first continuation. Same optimization libraries, new architecture: a separate worker generates variants asynchronously and nginx serves cache hits via zero-copy mmap. mod_pagespeed 1.1 also ships a maintained nginx port for drop-in upgrades.
Does ModPageSpeed 2.0 work with nginx 1.30?
Yes. ModPageSpeed 2.0 is tested against current nginx releases on Ubuntu 24.04, Debian 12, and Rocky 9. The archived ngx_pagespeed binaries do not build cleanly against nginx 1.26+.
Can I migrate my ngx_pagespeed config directly?
Not to 2.0 — the directive surface is intentionally smaller and the rewriting model is different. For a drop-in upgrade that keeps your existing pagespeed directives, install mod_pagespeed 1.1 from packages.modpagespeed.com.
Does the new module support AVIF?
Yes. Both ModPageSpeed 2.0 and mod_pagespeed 1.1 generate AVIF variants when the client signals support. The archived ngx_pagespeed never shipped AVIF.
Try it
- ModPageSpeed 2.0 —
curl -fsSL https://get.modpagespeed.com | sh· 14-day trial · nginx quickstart - mod_pagespeed 1.1 (nginx) —
apt install mod-pagespeed-nginxfrom packages.modpagespeed.com
Related
- mod_pagespeed alternative
- IISpeed alternative
- Google PageSpeed Module alternative
- Is mod_pagespeed deprecated? — what changed and what to use
- ModPageSpeed vs imgproxy
- ngxpagespeed.com — historical landing page for the nginx port