Skip to content

Instantly share code, notes, and snippets.

@kphrx
Last active May 13, 2020 13:13
Show Gist options
  • Save kphrx/cb389dd38a7ec9196a7b89df37c7c44e to your computer and use it in GitHub Desktop.
Save kphrx/cb389dd38a7ec9196a7b89df37c7c44e to your computer and use it in GitHub Desktop.
nginx-proxy and letsencrypt-nginx-proxy-companion for Docker compose version 3
version: '3.5'
services:
nginx-proxy:
image: jwilder/nginx-proxy:alpine
restart: always
network_mode: host
ports:
- "443:443"
- "80:80"
environment:
- ENABLE_IPV6=true
- VIRTUAL_HOST=example.com,www.exmaple.com
- LETSENCRYPT_HOST=example.com,www.exmaple.com
volumes:
- doc_root:/var/www
- html:/usr/share/nginx/html
- dhparam:/etc/nginx/dhparam
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- certs:/etc/nginx/certs:ro
- /var/run/docker.sock:/tmp/docker.sock:ro
labels:
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy"
autocert:
image: jrcs/letsencrypt-nginx-proxy-companion:latest
restart: always
depends_on:
- "nginx-proxy"
environment:
- [email protected]
- VIRTUAL_HOST=example.com,www.exmaple.com
volumes:
- html:/usr/share/nginx/html
- certs:/etc/nginx/certs:rw
- vhost:/etc/nginx/vhost.d
- /var/run/docker.sock:/var/run/docker.sock:ro
volumes:
doc_root:
driver_opts:
type: none
o: bind
device: /path/to/www
html:
driver_opts:
type: none
o: bind
device: /path/to/nginx/html
vhost:
driver_opts:
type: none
o: bind
device: /path/to/nginx/vhost.d
conf:
driver_opts:
type: none
o: bind
device: /path/to/nginx/conf.d
certs:
driver_opts:
type: none
o: bind
device: /path/to/nginx/certs
dhparam:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment