# ModPageSpeed — Full Reference (ModPageSpeed 2.0 + mod_pagespeed 1.15) > Self-hosted web performance optimization for nginx, Apache, IIS, Envoy, and ASP.NET Core. Built by a mod_pagespeed maintainer. Two products that share one optimization core and one cache, in different deployment shapes. ModPageSpeed 2.0 is a commercial product by We-Amp B.V. that automatically optimizes web content at the reverse-proxy level. It deploys as an nginx interceptor plus a separate factory worker sharing a disk cache, or as ASP.NET Core middleware (NuGet) for in-process optimization without a proxy. No application code changes, no URL rewrites, no build pipeline modifications required in the proxy mode. ## Product Overview ModPageSpeed 2.0 replaces the original mod_pagespeed RewriteDriver (2000+ LOC, 60+ filters) and uses the underlying PSOL optimization libraries directly. Optimization happens outside the request path in a separate worker process. The nginx module is a thin caching interceptor that classifies requests, serves cache hits via zero-copy mmap, and notifies the worker on misses. ### Heritage mod_pagespeed is the open-source optimization core that We-Amp's products continue. Per BuiltWith (May 2026), it powers 231,341 live sites today (1.9 million+ across its full history). These sites are not We-Amp customers — they are evidence the optimization core works at scale. Both products are built by a mod_pagespeed maintainer. ModPageSpeed 2.0 is a ground-up rewrite for modern infrastructure; mod_pagespeed 1.15 is the maintained continuation of the open-source codebase (renumbered from 1.1 — the forward-semver successor to the last upstream release, 1.14.36.1). ## Image Optimization - Automatic WebP and AVIF transcoding based on the client's Accept header - Viewport-aware resizing: Mobile (480px), Tablet (768px), Desktop (original) - Pixel density support: 1x and 2x+ (Retina) variants - Save-Data support: reduced quality when the user opts for less data - Proactive variant generation: a single image decode produces up to 37 variants per image — 36 raster (3 formats x 3 viewports x 2 densities x 2 Save-Data states) plus 1 SVG for eligible images - Lossless PNG reduction via OptiPNG - Animated GIF to animated WebP conversion - Quality settings: JPEG 85/60, WebP 75/50, AVIF 25/35 (normal/Save-Data) - Learned Quality Prediction: Per-format ML models (LightGBM compiled to C) predict optimal encoder quality for target SSIMULACRA2. Flags: --no-learned-quality, --no-learned-quality-{jpeg,webp,avif}. Falls back to heuristic when disabled or prediction invalid. - Content-aware quality classification: images classified as photo, screenshot, illustration, or noisy; compression adapted per class - Image denoising: bilateral filter applied to noisy images before encoding (--denoise-threshold, --denoise-sigma-spatial, --denoise-sigma-range) - Quality baselining: JPEG source quality detected from DQT tables; output capped at source quality + margin to prevent bloating low-quality sources - SSIMULACRA2 perceptual verification: re-encodes with adjusted quality until target score is met (--target-ssimulacra2, --ssimulacra2-tolerance, --ssimulacra2-max-attempts) - Safety limit: 50 MB max decoded pixel buffer (kMaxDecodedPixels) ## CSS Optimization - Four-phase minification: comment stripping, whitespace collapsing, trailing semicolon removal, decimal optimization (0.5 to .5) - Heuristic-based critical CSS extraction (works standalone, optional browser pipeline for Lighthouse validation) - Async CSS loading: render-blocking stylesheets made non-blocking by switching them to rel="preload" as="style" and turning them back into stylesheets, with their real media, once loaded, driven by a CSP-safe external loader served at a content-hashed path under /pagespeed_static/ (e.g. /pagespeed_static/async_css..js; the hash changes when the loader changes, so it is cached immutably). No inline onload, so it works under script-src 'self', with a