Updated: 28 September 2026 · Applies to: Nginx 1.24+
Google's PageSpeed module for Nginx (ngx_pagespeed) is no longer developed, and Nginx 1.12 and CentOS 7 are long out of support. We no longer recommend building Nginx with it.
What to use instead
- Current Nginx from your distribution or nginx.org (
dnf install nginx/apt install nginx). - Compression:
gzip on;(and Brotli where available). - Caching: long
expiresheaders for static files, and FastCGI or application caching for pages. - Images: serve WebP/AVIF and set width and height attributes.
- A CDN for visitors far from your server.
Example
gzip on;
gzip_types text/css application/javascript application/json image/svg+xml;
location ~* \.(css|js|jpg|jpeg|png|webp|svg|woff2)$ {
expires 30d;
add_header Cache-Control "public";
}