Skip to content

APT Repository Setup

The GetPageSpeed Extras APT repository hosts nginx-module-* packages for supported Debian and Ubuntu releases.

1. Install the APT keyring

Download the repository keyring and place it under /etc/apt/keyrings:

sudo install -d -m 0755 /etc/apt/keyrings
curl -fsSL https://extras.getpagespeed.com/deb-archive-keyring.gpg \
  | sudo tee /etc/apt/keyrings/getpagespeed.gpg >/dev/null

2. Add the APT source

You can either use the interactive helper below or copy one of the static examples.

Interactive generator

Select your distribution, codename, and NGINX branch to generate both the sources.list entry and a ready-to-run shell command:

sources.list contents:

Shell command to create file:

Alternative: auto-detect distro and codename

If you prefer a single universal command that works on any supported Debian or Ubuntu system, you can use lsb_release to detect the distribution and codename automatically.

For the stable branch:

distro=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
codename=$(lsb_release -cs)
echo "deb [signed-by=/etc/apt/keyrings/getpagespeed.gpg] https://extras.getpagespeed.com/${distro} ${codename} main" \
  | sudo tee /etc/apt/sources.list.d/getpagespeed-extras.list

For the mainline branch:

echo "deb [signed-by=/etc/apt/keyrings/getpagespeed.gpg] https://extras.getpagespeed.com/${distro} ${codename}-mainline main" \
  | sudo tee -a /etc/apt/sources.list.d/getpagespeed-extras.list

For the nginx-mod branch — GetPageSpeed-patched stable nginx with two extra statically-built modules (upstream_check, upstream_api) and the extended limit_req_rate units (r/h, r/d, r/w, r/M, r/Y). Enable both the nginx-mod suite and the matching stable suite so dynamic nginx-module-* packages remain installable alongside the patched nginx:

sudo tee /etc/apt/sources.list.d/getpagespeed-extras.list <<EOF
deb [signed-by=/etc/apt/keyrings/getpagespeed.gpg] https://extras.getpagespeed.com/${distro} ${codename}-nginx-mod main
deb [signed-by=/etc/apt/keyrings/getpagespeed.gpg] https://extras.getpagespeed.com/${distro} ${codename} main
EOF

nginx-mod is ABI-compatible with the stable nginx package, so any nginx-module-* package from the matching stable suite loads against it without rebuild. Installing nginx-mod swaps out any existing nginx package (it declares Conflicts: nginx).

Supported codenames for nginx-mod at launch: jammy, noble, bookworm.

3. Pin GetPageSpeed nginx packages

If you have (or may later add) another nginx source such as the ondrej/nginx PPA or nginx.org packages, create an APT preferences file so that GetPageSpeed packages always take priority:

sudo tee /etc/apt/preferences.d/getpagespeed-nginx.pref > /dev/null <<'EOF'
Package: nginx nginx-mod nginx-common nginx-core nginx-full nginx-extras nginx-light nginx-module-* libnginx-mod-*
Pin: origin extras.getpagespeed.com
Pin-Priority: 1001
EOF

Priority 1001 tells APT to prefer these packages even if it means downgrading or replacing versions from other repositories. The pin is scoped to nginx-related packages only — no other system packages are affected.

Tip

This step is recommended for all installations and required if any other nginx repository is configured on the system.

4. Update and install

After adding the repository and pinning, run:

sudo apt-get update

You can then install modules such as:

sudo apt-get install nginx-module-brotli

Migrating from other nginx repositories

If you already have nginx installed from the ondrej PPA, nginx.org, or stock Debian/Ubuntu packages, follow these steps to switch to GetPageSpeed:

  1. Complete steps 1–3 above (keyring, source, pinning).

  2. Update the package index:

    sudo apt-get update
    
  3. Replace the existing nginx and install modules in one command:

    sudo apt-get install nginx nginx-module-geoip2
    

    APT will automatically replace conflicting packages (nginx-core, nginx-common, nginx-full, nginx-extras, nginx-light) with GetPageSpeed's transitional packages that depend on the unified nginx package.

  4. Verify the active source:

    apt-cache policy nginx
    

    The output should show extras.getpagespeed.com with priority 1001.