njs Scripting Language

Integrate JavaScript-like code into the NGINX event-processing model for HTTP or TDP/UDP, with the NGINX njs module, supported by NGINX, Inc.

Installation Instructions

  1. Install the njs module.

    For Amazon Linux, CentOS, Oracle Linux, and RHEL:

    $ yum install nginx-plus-module-njs
    

    For Debian and Ubuntu:

    $ apt-get install nginx-plus-module-njs
    

    For SLES:

    $ zypper install nginx-plus-module-njs
    

    For Alpine:

    $ apk add nginx-plus-module-njs
    
  2. Put both of the load_module directives in the top‑level (“main”) context of NGINX Plus configuration file, nginx.conf:

    load_module modules/ngx_http_js_module.so;
    load_module modules/ngx_stream_js_module.so;
    
  3. Perform additional configuration as required by the module.

  4. Reload NGINX Plus to enable the module:

    $ nginx -t && nginx -s reload
    

More Info