nginx JavaScript module

njs is an nginx module that extends the server's functionality through JavaScript scripting, enabling the creation of custom server-side logic and more.

The built-in njs JavaScript engine is deprecated since 1.0.0; new configurations should use the QuickJS engine.

Use cases

See examples for more njs use cases.

Basic HTTP Example

To use njs in nginx:

There is also a standalone command line utility that can be used independently of nginx for njs development and debugging.

Tested OS and platforms

Presentation at nginx.conf 2018