Skip to content

let: NGINX let module

Debian/Ubuntu installation

These docs apply to the APT package nginx-module-let 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-let
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    |


NGINX let module

Adds support for arithmetic operations to NGINX config.

(c) 2011 Roman Arutyunyan, arut@qip.ru

Examples:

adds variable $value equal to evaluated expression value

let $value ( $uid + 0x12 ) * $offset - 100 ;

let $remainer $number % 100 ;

let $welcome "Hi, " . $user . ", you have " . $num . " data items";

echo $welcome ;

let_rand $randval from to;

IMPORTANT NOTE:

let-module uses NGINX config parser as lexer. That means you should add spaces around each token.

let $value (1+2); # ERROR! let $value ( 1 + 2 ); # OK

let $value 1 + (2 * $uid); # ERROR! let $value 1 + ( 2 * $uid ); # OK

Features supported:

  • operations with unsigned integers:

      • / %
  • string operations:

. (concatenation)

  • hexadecimal numbers

  • grouping with parentheses

Notes:

Use the following command to rebuild parser generator if you need that

bison -d let.y