NJS stands for NGINX JavaScript, a dynamic module for NGINX that extends server functionality through JavaScript scripting. It allows administrators to write custom request handlers, implement complex access control logic, and manipulate response headers using a subset of JavaScript syntax.
Key characteristics include:
- JavaScript Integration: It enables the use of familiar JavaScript syntax to extend NGINX without requiring Lua or C.
- Performance: Scripts run inside the NGINX worker process with minimal overhead and are precompiled at configuration load time.
- Engines: It supports two JavaScript engines: the built-in njs engine (deprecated since version 1.0.0) and the recommended QuickJS engine, which offers full ES2023 support.
- Capabilities: It provides access to request/response data, subrequests, shared memory, and external URL fetching within a secure sandbox.
