Skip to content

Instantly share code, notes, and snippets.

@Saanch
Created October 7, 2017 11:44
Show Gist options
  • Save Saanch/47d3d6ccba6c22e3d7b3c71c01d1243c to your computer and use it in GitHub Desktop.
Save Saanch/47d3d6ccba6c22e3d7b3c71c01d1243c to your computer and use it in GitHub Desktop.
nginx reverse proxy letsencrypt docker-compose
version: '3'
services:
nginx:
image: nginx
container_name: nginx
ports:
- '80:80'
- '443:443'
volumes:
- 'nginx-config:/etc/nginx/conf.d'
- 'nginx-certs:/etc/nginx/certs'
- 'nginx-vhosts:/etc/nginx/vhost.d'
- 'nginx-webroot:/usr/share/nginx/html'
dockergen:
image: jwilder/docker-gen
container_name: nginx-docker-gen
command: -notify-sighup nginx -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
volumes:
- 'nginx-config:/etc/nginx/conf.d'
- 'nginx-certs:/etc/nginx/certs'
- 'nginx-vhosts:/etc/nginx/vhost.d'
- 'nginx-webroot:/usr/share/nginx/html'
- '/var/run/docker.sock:/tmp/docker.sock:ro'
- './nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl'
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
environment:
NGINX_DOCKER_GEN_CONTAINER: nginx-docker-gen
volumes:
- 'nginx-config:/etc/nginx/conf.d'
- 'nginx-certs:/etc/nginx/certs'
- 'nginx-vhosts:/etc/nginx/vhost.d'
- 'nginx-webroot:/usr/share/nginx/html'
- '/var/run/docker.sock:/var/run/docker.sock:ro'
volumes:
nginx-config:
nginx-certs:
nginx-vhosts:
nginx-webroot:
networks:
default:
external:
name: nginx-proxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment