Skip to content

Notes for njs and Nginx modules development in Js

Notifications You must be signed in to change notification settings

JSThreads/njs-notes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published