Nginx Reverse Proxy
Nginx runs as a global-mode service (one instance per Swarm node) within the DEV stack (dev_nginx). It handles all incoming HTTPS traffic, terminates SSL, and routes requests to the correct internal service. Despite being in the DEV stack, it serves all environments (DEV, UAT, and Shared) by connecting to all overlay networks.
Service Details
Section titled “Service Details”| Property | Value |
|---|---|
| Service name | dev_nginx |
| Deploy mode | Global (1 replica per node) |
| Ports | 80 (→ HTTPS redirect), 443 (SSL) |
| Networks | dev_sseris-network, sseris-uat-network, shared_harbor |
| Configs | 24+ Docker configs for server blocks |
| SSL certs | Mounted from /etc/letsencrypt/live/ayinza.dev/ |
How It Works
Section titled “How It Works”- All
*.ayinza.devDNS records point to Contabo (84.247.134.135) - Nginx on Contabo receives the request, checks the
server_name - Routes to the correct internal Docker service via overlay network
- DEV services on Azure are reachable through the overlay network
Docker Configs
Section titled “Docker Configs”Nginx server blocks are stored as Docker configs, not files on disk. Each domain has its own config.
# List all nginx configsdocker config ls | grep nginx
# Inspect a specific configdocker config inspect <config_name> --prettyAdding a New Domain
Section titled “Adding a New Domain”-
Create the nginx config file with the server block:
server {listen 443 ssl;server_name newservice.ayinza.dev;ssl_certificate /etc/letsencrypt/live/ayinza.dev/fullchain.pem;ssl_certificate_key /etc/letsencrypt/live/ayinza.dev/privkey.pem;location / {proxy_pass http://service-name:port;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;}} -
Create a Docker config from the file:
Terminal window docker config create nginx_newservice_conf newservice.conf -
Update
nginx.ymlto reference the new config and mount it in the Nginx service -
Redeploy Nginx:
Terminal window docker stack deploy -c /home/kaks/stacks/nginx.yml dev -
Verify by visiting
https://newservice.ayinza.dev
Stack File
Section titled “Stack File”Located at /home/kaks/stacks/nginx.yml on Azure.