-
Notifications
You must be signed in to change notification settings - Fork 85
doc: use shared_dict for dynamic certs demo #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
as NJS v0.8.0 is not available in nginx docker images as of today, you can use: # syntax=docker/dockerfile:1
ARG NGINX_VERSION=1.25.1
ARG NJS_VERSION=0.8.0
FROM nginx:${NGINX_VERSION}
ARG NGINX_VERSION
ARG NJS_VERSION
RUN --mount=type=cache,target=/var/cache/apt <<EOF
set -eux
export DEBIAN_FRONTEND=noninteractive
apt-get -qq update
apt-get -qq install --yes --no-install-recommends --no-install-suggests \
curl gnupg2 ca-certificates debian-archive-keyring inotify-tools
update-ca-certificates
apt-get remove --purge --auto-remove --yes
EOF
# As of 07/13/2023 NJS v0.8.0 is not included into nginx docker image.
# This a temprary to install it
# Following installation steps from http://nginx.org/en/linux_packages.html#Debian
RUN --mount=type=cache,target=/var/cache/apt <<EOF
set -eux
export DEBIAN_FRONTEND=noninteractive
apt-get -qq update
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \
| tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
gpg --dry-run --quiet --no-keyring --import --import-options import-show \
/usr/share/keyrings/nginx-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
http://nginx.org/packages/mainline/debian $(echo $PKG_RELEASE | cut -f2 -d~) nginx" \
| tee /etc/apt/sources.list.d/nginx.list
apt-get -qq update
apt-get -qq install --yes --no-install-recommends --no-install-suggests \
nginx-module-njs=${NGINX_VERSION}+${NJS_VERSION}-${PKG_RELEASE}
apt-get remove --purge --auto-remove --yes
rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx.list
EOF
|
a51762c
to
473ac84
Compare
README.rst
Outdated
* - Validate and sanitize uploaded file content to prevent security risks. | ||
*/ | ||
|
||
import fs from 'fs' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this is an example, I suggest to remove non-essential code from the .rst page, leave only the crucial parts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please take a look again.
README.rst
Outdated
|
||
Note: this example below work with njs >= `0.8.0 <http://nginx.org/en/docs/njs/changes.html#njs0.8.0>`_. | ||
|
||
This example demonstrtaes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
demonstrtaes -> demonstrates
} | ||
|
||
|
||
Here we would implement ``js_set`` handlers that reads cert/key from a FS or from `shared_dict`` (used as a cache here): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would implement -> implement ?
This demo shows how to use the new shared_dict_zone with NJS v.0.8.0 and up to set up NGINX to serve encrypted traffic without server restarts when the certificate or key changes occur