Skip to content

coolkit: NGINX CoolKit Module

Debian/Ubuntu installation

These docs apply to the APT package nginx-module-coolkit provided by the GetPageSpeed Extras repository.

  1. Configure the APT repository as described in APT repository setup.
  2. Install the module:
sudo apt-get update
sudo apt-get install nginx-module-coolkit
Show suites and architectures
| Distro   | Suite                   | Component   | Architectures   |
|----------|-------------------------|-------------|-----------------|
| debian   | bookworm                | main        | amd64, arm64    |
| debian   | bookworm-mainline       | main        | amd64, arm64    |
| debian   | bookworm-mainline-early | main        | amd64, arm64    |
| debian   | trixie                  | main        | amd64, arm64    |
| debian   | trixie-mainline         | main        | amd64, arm64    |
| debian   | trixie-mainline-early   | main        | amd64, arm64    |
| ubuntu   | focal                   | main        | amd64, arm64    |
| ubuntu   | focal-mainline          | main        | amd64, arm64    |
| ubuntu   | focal-mainline-early    | main        | amd64, arm64    |
| ubuntu   | jammy                   | main        | amd64, arm64    |
| ubuntu   | jammy-mainline          | main        | amd64, arm64    |
| ubuntu   | jammy-mainline-early    | main        | amd64, arm64    |
| ubuntu   | noble                   | main        | amd64, arm64    |
| ubuntu   | noble-mainline          | main        | amd64, arm64    |
| ubuntu   | noble-mainline-early    | main        | amd64, arm64    |
| ubuntu   | resolute                | main        | amd64, arm64    |
| ubuntu   | resolute-early          | main        | amd64, arm64    |
| ubuntu   | resolute-mainline       | main        | amd64, arm64    |
| ubuntu   | resolute-mainline-early | main        | amd64, arm64    |

ABOUT:

ngx_coolkit is collection of small and useful nginx add-ons.

CONFIGURATION DIRECTIVES:

override_method off | [methods] source (context: http, server, location)

Override HTTP method.

default: none

CONFIGURATION VARIABLES:

$remote_passwd

Decoded password from "Authorization" header (Basic HTTP Authentication).

$location

Name of the matched location block.

EXAMPLE CONFIGURATION #1:

http { server { location / { override_method $arg_method; proxy_pass http://127.0.0.1:8100; } } }

Pass request with changed HTTP method (based on "?method=XXX") to the backend.

EXAMPLE CONFIGURATION #2:

http { upstream database { postgres_server 127.0.0.1 dbname=test user=monty password=some_pass; }

server {
    location = /auth {
        internal;

        set_quote_sql_str  $user $remote_user;
        set_quote_sql_str  $pass $remote_passwd;

        postgres_pass      database;
        postgres_query     "SELECT login FROM users WHERE login=$user AND pass=$pass";
        postgres_rewrite   no_rows 403;
        postgres_output    none;
    }

    location / {
        auth_request       /auth;
        root               /files;
    }
}

}

Restrict access to local files by authenticating against SQL database.

Required modules (other than ngx_coolkit): - ngx_http_auth_request_module, - ngx_postgres (PostgreSQL) or ngx_drizzle (MySQL, Drizzle, SQLite), - ngx_set_misc.