5. NGINX Dataplane Scripting¶
In each lab we will configure an NGINX server to either provide content itself or act as a reverse proxy that retrieves content from other servers.
We will use Docker to deploy each lab environment locally on the student's machine where all servers will run in a single Docker container. While Docker containers are ideal for running NGINX, the same concepts apply when running NGINX in a VM or on a bare metal server.
While a lab system is provided for you in UDF, we encourage you to run the labs locally on your own system if you can. To do that, you'll need to have two applications installed:
- Docker Desktop for Windows or MacOS ( https://www.docker.com/products/docker-desktop)
- A git client ( https://git-scm.com/downloads )
If you already have access to a Linux system with Docker and git, you're all set.
Verify your System is Ready
First make sure you have git and Docker available. Open up a terminal on your system (or Windows Command Prompt) and try the following commands:
(Note: The command is highlighted. The output is not.)
git --version git version 2.25.0 docker --version Docker version 19.03.8, build afacb8b
If both the git and docker commands work, you are ready to continue by clicking the next button below.
Expected time to complete: 1 hour
A listing of the modules for this class is listed below. This same list is also available on the left column of every page for direct access.
- 5.1. Getting Started
- 5.2. Hello World [hello]
- 5.3. Decode URI [decode_uri]
- 5.4. Extract JWT Payload into NGINX Variable [jwt]
- 5.5. Subrequests join [join_subrequests]
- 5.6. Secure hash [secure_link_hash]
- 5.7. File IO [file_io]
- 5.8. Complex redirects using njs file map. [complex_redirects]
- 5.9. Injecting HTTP header using stream proxy [stream/inject_header]
- 5.10. Generating JWT token [gen_hs_jwt]
- 5.11. Choosing upstream in stream based on the underlying protocol [stream/detect_http]