Skip to content

Instantly share code, notes, and snippets.

@deskoh
Last active July 2, 2021 07:57
Show Gist options
  • Save deskoh/e47d414a02c046f53d1b3ad628745aff to your computer and use it in GitHub Desktop.
Save deskoh/e47d414a02c046f53d1b3ad628745aff to your computer and use it in GitHub Desktop.
Auto NGINX Proxy for Docker Environments
version: '3.1'
services:
nginx-proxy:
image: jwilder/nginx-proxy:alpine
restart: unless-stopped
environment:
# Disable redirect and HSTS
HTTPS_METHOD: noredirect
# Disable Diffie-Hellman parameters
DHPARAM_GENERATION: "false"
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./certs:/etc/nginx/certs
nginx:
image: nginx:alpine
restart: unless-stopped
environment:
VIRTUAL_HOST: nginx.127.0.0.1.nip.io
# VIRTUAL_PORT: 80
# Use `server.crt` and `server.key` in `./certs` directory for SSL
CERT_NAME: server
deploy:
replicas: 2
resources:
limits:
cpus: '1'
expose:
- 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment