Please assist.
I found a blog post, https://blog.ssdnodes.com/blog/host-multiple-ssl-websites-docker-nginx/) regarding deploying multiple docker-compose application with the same nginx-proxy
but with different VIRTUAL_HOST
names
But for some reason, both applications are returning an Error 502 Bad Gateway
The following error is what I see when I run docker-compose logs nginx
2019/05/29 20:52:26 [error] 8#8: *15 connect() failed (111: Connection refused) while connecting to upstream, client: 52.209.30.187, server: gregsithole.com, request: "GET / HTTP/1.1", upstream: "http://172.20.0.5:80/", host: "gregsithole.com"
And I believe the upstream
is using an internal docker network IP because that's not the IP for my Server. My upstream is determined by the following file: https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl
But I'm not too familiar with how it works.
The following is an example of my docker-compose files:
nginx-proxy/docker-compose.yaml
version: "3.6"
services:
nginx:
image: nginx
container_name: nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- certs:/etc/nginx/certs
labels:
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"
dockergen:
image: jwilder/docker-gen
container_name: nginx-proxy-gen
restart: always
depends_on:
- nginx
command: -notify-sighup nginx-proxy -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
volumes:
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- certs:/etc/nginx/certs
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: nginx-proxy-le
restart: always
depends_on:
- nginx
- dockergen
environment:
NGINX_PROXY_CONTAINER: nginx-proxy
NGINX_DOCKER_GEN_CONTAINER: nginx-proxy-gen
volumes:
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- certs:/etc/nginx/certs
- /var/run/docker.sock:/var/run/docker.sock:ro
volumes:
conf:
vhost:
html:
certs:
networks:
default:
external:
name: nginx-proxy
dockerized-ghost/docker-compose.yaml
version: "3.6"
services:
ghost:
image: ghost
restart: always
expose:
- 80
volumes:
- ../../ghost:/var/lib/ghost/content
environment:
NODE_ENV: production
url: https://blog.gregsithole.com
VIRTUAL_HOST: blog.gregsithole.com
LETSENCRYPT_HOST: blog.gregsithole.com
LETSENCRYPT_EMAIL: hidden-email
networks:
default:
external:
name: nginx-proxy
Please assist