Created
February 11, 2016 08:12
-
-
Save royingantaginting/ef413a15cb4ae8b60112 to your computer and use it in GitHub Desktop.
Nginx reverse proxy with automatic https certificate generation from Letsencrypt https://letsencrypt.org/.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proxy: | |
image: jwilder/nginx-proxy | |
volumes: | |
- ./opt/certs:/etc/nginx/certs:ro | |
- /etc/nginx/vhost.d | |
- /usr/share/nginx/html | |
- /var/run/docker.sock:/tmp/docker.sock:ro | |
ports: | |
- "80:80" | |
- "443:443" | |
restart: always | |
le: | |
image: jrcs/letsencrypt-nginx-proxy-companion | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
- ./opt/certs:/etc/nginx/certs:rw | |
volumes_from: | |
- proxy | |
restart: always |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Then start any containers you want to be proxied with a env var
VIRTUAL_HOST=subdomain.youdomain.com
. To use the Let's Encrypt service to automatically create a valid certificate for virtual host(s). Set the following environment variables to automatically create a valid certificateLETSENCRYPT_HOST
LETSENCRYPT_EMAIL
The
LETSENCRYPT_HOST
variable most likely needs to be the same as theVIRTUAL_HOST
variable and must be publicly reachable domains. Specify multiple hosts with a comma delimiter. TheLETSENCRYPT_EMAIL
variable must be a valid email address