diff --git a/README.md b/README.md index 53e8d5d03..bc34087cd 100644 --- a/README.md +++ b/README.md @@ -273,6 +273,11 @@ If you are using multiple hostnames for a single container (e.g. `VIRTUAL_HOST=e If you want most of your virtual hosts to use a default single `location` block configuration and then override on a few specific ones, add those settings to the `/etc/nginx/vhost.d/default_location` file. This file will be used on any virtual host which does not have a `/etc/nginx/vhost.d/{VIRTUAL_HOST}` file associated with it. +#### docker-compose for nginx-proxy and letsencrypt + +- use "docker-compose-letsencrypt-ssl.yml" to run nginx-proxy and letsencrypt containers +- refer "docker-compose-nginx-letencrypt-app-example.yml" to configure necessary variables + ### Contributing Before submitting pull requests or issues, please check github to make sure an existing issue or pull request is not already open. diff --git a/docker-compose-letsencrypt-ssl.yml b/docker-compose-letsencrypt-ssl.yml new file mode 100644 index 000000000..1c80b9e51 --- /dev/null +++ b/docker-compose-letsencrypt-ssl.yml @@ -0,0 +1,41 @@ +version: '2' +services: + nginx-proxy: + image: jwilder/nginx-proxy + container_name: nginx-proxy + ports: + - "80:80" + - "443:443" + volumes: + - /home/core/data/nginx-proxy/certs:/etc/nginx/certs:ro + - /home/core/data/nginx-proxy/vhost.d:/etc/nginx/vhost.d:rw +# - /etc/nginx/vhost.d +# - /usr/share/nginx/html + - /home/core/data/nginx-proxy/html:/usr/share/nginx/html:rw + - /var/run/docker.sock:/tmp/docker.sock:ro + labels: + - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true" + +# in case of any issues comment "/home/core/data/nginx-proxy/vhost.d:/etc/nginx/vhost.d" and "/home/core/data/nginx-proxy/html:/usr/share/nginx/html" from above volumes block + + + letsencrypt-nginx-proxy-companion: + image: jrcs/letsencrypt-nginx-proxy-companion + container_name: letsencrypt-nginx-proxy-companion + volumes: + - /home/core/data/nginx-proxy/certs:/etc/nginx/certs:rw + - /var/run/docker.sock:/var/run/docker.sock:ro + volumes_from: + - nginx-proxy + + +# whoami: +# image: jwilder/whoami +# environment: +# - VIRTUAL_HOST=whoami.local + +networks: + default: + external: + name: nginx-proxy-bridge-network + diff --git a/docker-compose-nginx-letencrypt-app-example.yml b/docker-compose-nginx-letencrypt-app-example.yml new file mode 100644 index 000000000..a5b30d40f --- /dev/null +++ b/docker-compose-nginx-letencrypt-app-example.yml @@ -0,0 +1,41 @@ +version: "2" + +services: + web: + image: 'app-image' + restart: always + environment: + - TERM=xterm + - LETSENCRYPT_EMAIL=admin@example.com + - LETSENCRYPT_HOST=example.com + - VIRTUAL_HOST=example.com + - VIRTUAL_PROTO=https + - VIRTUAL_PORT=8080 + hostname: 'example.com' + expose: + - "8080" + build: . + volumes: + - /data/nginx-proxy/certs/:/etc/ssl/example.com + - /data/qbank-lite/webapps:/qbank/webapps + - .:/qbank + command: > + /bin/bash -c 'python myapp.py' + ports: + - "8010:8080" + links: + - mongo:mongodb + depends_on: + - mongo + mongo: + image: 'mongo:latest' + restart: always + environment: + - ALLOW_EMPTY_PASSWORD=yes + volumes: + - /data/myapp/db:/data/db + +networks: + default: + external: + name: example-bridge-network