Last active
May 28, 2024 23:13
-
-
Save w33ble/ab51b77641e499968c354ca02e4bccf0 to your computer and use it in GitHub Desktop.
Using jwilder/nginx-proxy with multiple compose files
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
version: '3' | |
services: | |
nginx-proxy: | |
image: nginx:alpine | |
container_name: proxy-nginx | |
environment: | |
- DEFAULT_HOST=hello.local | |
ports: | |
- 80:80 | |
- 443:443 | |
volumes: | |
- conf:/etc/nginx/conf.d:ro | |
- vhost:/etc/nginx/vhost.d:ro | |
- html:/usr/share/nginx/html:ro | |
- certs:/etc/nginx/certs:ro | |
dockergen: | |
image: jwilder/docker-gen | |
container_name: proxy-dockergen | |
command: -notify-sighup proxy-nginx -wait 5s:30s -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf | |
volumes: | |
- /var/run/docker.sock:/tmp/docker.sock:ro | |
- ./templates:/etc/docker-gen/templates:rw # curl -o templates/nginx.tmpl https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl | |
- conf:/etc/nginx/conf.d | |
- vhost:/etc/nginx/vhost.d:ro | |
- html:/usr/share/nginx/html | |
- certs:/etc/nginx/certs:ro | |
environment: | |
- DEFAULT_HOST=hello.local | |
letsencrypt: | |
image: jrcs/letsencrypt-nginx-proxy-companion | |
container_name: proxy-letsencrypt | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
- ./templates:/etc/docker-gen/templates:ro | |
- conf:/etc/nginx/conf.d | |
- vhost:/etc/nginx/vhost.d | |
- html:/usr/share/nginx/html | |
- certs:/etc/nginx/certs | |
environment: | |
- [email protected] | |
- NGINX_PROXY_CONTAINER=proxy-nginx | |
- NGINX_DOCKER_GEN_CONTAINER=proxy-dockergen | |
hello: | |
image: nginx:alpine | |
environment: | |
- VIRTUAL_HOST=hello.local | |
volumes: | |
- ./index.html:/usr/share/nginx/html/index.html | |
networks: | |
default: | |
external: | |
name: nginx-proxy | |
volumes: | |
conf: | |
certs: | |
vhost: | |
html: |
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
version: '3' | |
services: | |
thing: | |
image: jwilder/whoami | |
environment: | |
- VIRTUAL_PORT=8000 | |
- VIRTUAL_HOST=whoami.local | |
# in order for the proxy to see this service, it needs to be on the same network | |
networks: | |
default: | |
external: | |
name: nginx-proxy |
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
version: '3' | |
networks: | |
default: | |
external: | |
name: nginx-proxy | |
services: | |
nginx-proxy: | |
image: jwilder/nginx-proxy | |
environment: | |
- DEFAULT_HOST=hello.local | |
ports: | |
- 80:80 | |
volumes: | |
- /var/run/docker.sock:/tmp/docker.sock:ro | |
hello: | |
image: nginx:alpine | |
environment: | |
- VIRTUAL_HOST=hello.local | |
volumes: | |
- ./index.html:/usr/share/nginx/html/index.html |
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
$ curl -H "Host: whoami.local" localhost |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment