Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

(Compose v2) Cant add own content - 502 Bad content // 111 Connection refused #12

Open
victor-lund opened this issue Oct 25, 2016 · 1 comment

Comments

@victor-lund
Copy link

victor-lund commented Oct 25, 2016

OK, So I have cloned the example image and substituted the "example.com" domain with my own but when trying to add my own content, The browser gives me 502 Bad Gateway.

This is my config:

/examples/docker-compose/v2/simple-site/docker-compose.yml

version: "2"
services:
  nginx:
    image: nginx
    container_name: nginx
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "/etc/nginx/conf.d"
      - "/etc/nginx/vhost.d"
      - "/usr/share/nginx/html"
      - "../../../volumes/proxy/certs:/etc/nginx/certs:ro"
    networks:
      - proxy-tier


  nginx-gen:
    image: jwilder/docker-gen
    container_name: nginx-gen
    volumes:
      - "/var/run/docker.sock:/tmp/docker.sock:ro"
      - "../../../volumes/proxy/templates/nginx-compose-v2.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro"
    volumes_from:
      - nginx
    entrypoint: /usr/local/bin/docker-gen -notify-sighup nginx -watch -only-exposed -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf


  letsencrypt-nginx-proxy-companion:
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: letsencrypt-nginx-proxy-companion
    volumes_from:
      - nginx
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "../../../volumes/proxy/certs:/etc/nginx/certs:rw"
    environment:
      - NGINX_DOCKER_GEN_CONTAINER=nginx-gen
      - DEBUG=true


  simple-site:
    image: nginx
    container_name: simple-site
    volumes:
      - "../../../volumes/examples/simple-site/conf.d/:/etc/nginx/conf.d"
      - "../../../volumes/examples/simple-site/site:/var/www/html"
    environment:
      - VIRTUAL_HOST=test.mydomain.com
      - VIRTUAL_NETWORK=nginx-proxy
      - VIRTUAL_PORT=80
      - LETSENCRYPT_HOST=test.mydomain.com
      - [email protected]
    networks:
      - proxy-tier

/examples/volumes/examples/simple-site/conf.d/test.mydomain.com

  server {
    listen                  80;
    server_name             test.mydomain.com;

    index index.html index.htm;

    root /var/www/html;

    location / {
                try_files index.htm index.html;
    }

}

/examples/volumes/examples/simple-site/site/index.html


<!DOCTYPE html>
<html>
<body>
<p>ok</p>
</body>
</html>

When running:

docker network create -d bridge nginx-proxy; docker-compose up -d

everything downloads and installs fine. However - when i visit test.mydomain.com i get 502 Bad Gateway

Running

docker logs nginx

gives me:

2016/10/25 09:58:02 [error] 7#7: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 85.254.129.255, server: test.mydomain.com, request: "GET / HTTP/2.0", upstream: "http://172.18.0.2:80/", host: "test.mydomain.com"
test.mydomain.com 85.254.129.255 - - [25/Oct/2016:09:58:02 +0000] "GET / HTTP/2.0" 502 638 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36"
2016/10/25 09:58:02 [error] 7#7: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 85.254.129.255, server: test.mydomain.com, request: "GET /favicon.ico HTTP/2.0", upstream: "http://172.18.0.2:80/favicon.ico", host: "test.mydomain.com", referrer: "https://test.mydomain.com/"
test.mydomain.com 85.254.129.255 - - [25/Oct/2016:09:58:02 +0000] "GET /favicon.ico HTTP/2.0" 502 638 "https://test.mydomain.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36"
@danhimalplanet
Copy link

What version of docker-compose are you using?

I had a similar problem.

I upgraded docker-compose with

'sudo pip install docker-compose --upgrade'

Now that I'm using docker-compose version 1.8.1, this works for me now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants