Skip to content

Instantly share code, notes, and snippets.

@RaD
Created December 6, 2019 08:02
Show Gist options
  • Save RaD/e8a879c150f083a88c02a268e4b96f02 to your computer and use it in GitHub Desktop.
Save RaD/e8a879c150f083a88c02a268e4b96f02 to your computer and use it in GitHub Desktop.
SSL for services
# Конфигурация для запуска nginx в качестве SSL прокси для других контейнеров.
# Не забудьте создать сеть перед запуском этой конфигурации:
# docker network create nginx-proxy
# и добавить следующую строку к проксируемым контейнерам '--network nginx-proxy'.
version: '2'
services:
nginx:
image: nginx
container_name: nginx
ports:
- "80:80"
- "443:443"
volumes:
- certs:/etc/nginx/certs
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
labels:
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"
dockergen:
image: jwilder/docker-gen
container_name: nginx-gen
depends_on:
- nginx
volumes_from:
- nginx
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- /home/docker/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro
command: -notify-sighup nginx -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: nginx-le
depends_on:
- nginx
- dockergen
volumes_from:
- nginx
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
NGINX_PROXY_CONTAINER: nginx
NGINX_DOCKER_GEN_CONTAINER: nginx-gen
volumes:
conf:
vhost:
html:
certs:
networks:
default:
external:
name: nginx-proxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment