How nginxinc/nginx-basics-workshops works
Project Type and Purpose
• This repository is a hands-on workshop/lab environment for teaching NGINX (both OSS and Plus) using Docker Compose.
• It is not a typical full-stack web application but a training topology: NGINX front-ends, backend web servers, and monitoring tools (Prometheus/Grafana) orchestrated via Docker.
• The README and lab folders (OSS/labs and Plus/labs) clearly describe sequential exercises (lab0 → lab7) to build, configure, and extend NGINX configurations.
File Structure Analysis
• Top-level: README, CONTRIBUTING, LICENSE, media assets.
• Two parallel lab trees: OSS/labs and Plus/labs, each containing subfolders lab0–lab7.
• Each lab folder has a docker-compose.yml and a container build context (nginx-oss or nginx-plus).
• Within each NGINX build context you find Dockerfile, /etc/nginx configs, /usr/share/nginx/html sample pages, SSL artifacts, include files, etc.
• Monitoring labs add Prometheus configs and sometimes Grafana.
• Older (old/) directories show legacy examples (API gateway, caching), but the active path is under OSS/labs and Plus/labs.
Key README Insights
• Topology: one NGINX proxy/load-balancer, three backend web servers, Prometheus, Grafana.
• Containers:
• nginx-oss or nginx-plus – the front-end
• web1, web2, web3 – simple NGINX demo servers
• prometheus, grafana – monitoring
• Docker network: bridged, internal DNS (127.0.0.11) for container name resolution.
• Exercises demonstrate: HTTP proxy, SSL termination, load balancing, logging, rate limiting, API management, metrics scraping.
Main Components
a. User/Client (Browser, CLI Tools)
b. Docker Host (the developer laptop/VM running Docker)
c. Docker Network (bridge with DNS)
d. Front-end Proxy – NGINX OSS or NGINX Plus container
e. Backend Web Servers – containers web1, web2, web3
f. Monitoring Stack – Prometheus (scrape targets), Grafana (visualization)
g. External Services – optional (e.g., external DNS resolution, certificate authority)
Component Relationships & Interactions
• Client → (HTTP/HTTPS) → NGINX
• NGINX → (upstream load balancing) → web1/web2/web3
• NGINX → (exported metrics endpoint) → Prometheus
• Prometheus → (data storage + query) → Grafana
• (In TLS labs) Client → NGINX terminates SSL → unencrypted upstream
• (In API-gateway labs) NGINX applies JWT auth, rate limits, proxy_pass to API backends.
Architectural Patterns & Design Principles
• Edge Proxy Pattern: NGINX as a reverse proxy/load-balancer at the edge.
• Service Discovery: Docker DNS internally resolves container names.
• Separation of Concerns: front-end proxy vs. backend web servers vs. monitoring.
• Immutable Infrastructure: containers are built with specific Dockerfiles and configuration included at build time.
• Incremental Complexity: each lab layer adds features (SSL, caching, monitoring, API management).
Technologies & Frameworks
• Docker & Docker Compose for orchestration.
• NGINX OSS (Alpine) and NGINX Plus (Debian) images.
• NGINX configuration includes conf.d/, includes/, SSL assets.
• Prometheus (YAML scrape config) and Grafana (dashboard container).
• Sample web server images based on nginxinc/ingress-demo.