JSThreads / njs-notes

Notes for njs and Nginx modules development in Js

Repository from Github https://github.comJSThreads/njs-notesRepository from Github https://github.comJSThreads/njs-notes

Njs notes

njsbannerwithbg

~ Notes for njs and Nginx modules development in Js

Introduction

Nginx modules can be written in multiple languages like C, Perl, Lua or Js with Njs. Because of a compiler written by the team of Nginx you shouldn't use it for big calculus or cryptography.

Installation

You can install njs with the next commands for ubuntu:

# To run in admin mode or with sudo
apt update

apt install -y curl gnupg2 ca-certificates lsb-release debian-archive-keyring
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" | tee /etc/apt/sources.list.d/nginx.list
apt update
apt install -y nginx-module-njs

Finally you have to add the next line to /etc/nginx/nginx.conf and start nginx:

load_module modules/ngx_http_js_module.so;
# To run in admin mode or with sudo
service nginx start

🐳 ~ For testing, you can use a Docker image that I have created for this.

Pages

  1. First steps
  2. Simple auth
  3. Header filtring
  4. JWT fetching data from header

About

Notes for njs and Nginx modules development in Js


Languages

Language:Dockerfile 100.0%