title: Jwilder nginx proxy - 503 after docker compose structure update
body: <p>I'm using <code>jwilder/nginx-proxy</code> with separate <code>docker-compose.yaml</code>. It looks like this:</p>
  
  <pre><code>proxy:
     image: jwilder/nginx-proxy
     restart: always
     volumes:
       - /var/run/docker.sock:/tmp/docker.sock:ro
       - ./nginx/conf.d/proxy.conf:/etc/nginx/conf.d/proxy.conf:ro
       - /Users/marcin/Docker/local_share/certificates:/etc/nginx/certs:ro      
     ports:
       - "80:80"
       - "443:443"
     container_name: proxy
  </code></pre>
  
  <p>I'm using it for quite a long time and it's working fine when my project <code>docker-compose.yaml</code> looks like this:</p>
  
  <pre><code>web:
    build: /Users/marcin/Docker/definitions/php-nginx/php-7.1-ubuntu
    volumes:
      - /Users/marcin/Docker/projects/test.local/html/:/usr/share/nginx/html/
      - /Users/marcin/Docker/projects/test.local/nginx/conf.d/:/etc/nginx/conf.d/
      - /Users/marcin/Docker/projects/test.local/nginx/log/:/var/log/nginx/
      - /Users/marcin/Docker/projects/test.local/supervisor/conf.d/:/etc/supervisor/conf.d/
      - /Users/marcin/Docker/projects/test.local/supervisor/log/:/var/log/supervisor/
      - /Users/marcin/Docker/projects/test.local/cron/:/root/.cron/
      - /Users/marcin/Docker/local_share/:/root/.local_share/
      - /Users/marcin/Docker/local_share/certificates/:/usr/share/nginx/certificates/  
    working_dir: /usr/share/nginx/html/
    links:
      - db
    container_name: test.php
    hostname: test.local
    ports:
      - "336:22"
      - "8081:80"
      - "18080:443"    
    environment:
      - VIRTUAL_HOST=test.local   
      - CERT_NAME=default
      - HTTPS_METHOD=noredirect
  db:
    build: /Users/marcin/Docker/definitions/mysql/5.7
    environment:
       - MYSQL_ROOT_PASSWORD=pass
       - MYSQL_DATABASE=
       - MYSQL_USER=
       - MYSQL_PASSWORD=
    expose:
       - 3306
    volumes:
      - /Users/marcin/Docker/projects/test.local/mysql/data/:/var/lib/mysql/
      - /Users/marcin/Docker/projects/test.local/mysql/conf.d/:/etc/mysql/conf.d/source
      - /Users/marcin/Docker/projects/test.local/mysql/log/:/var/log/mysql/
    ports:
      - "33060:3306"
    container_name: test.db
    hostname: test.local
  </code></pre>
  
  <p>I can access site without any problem using <code>http://test.local</code> or <code>https://test.local</code> what is expected.</p>
  
  <p>However I had to update my file structure to newer version:</p>
  
  <pre><code>version: "3.2"
  services:
    web:
      build: /Users/marcin/Docker/definitions/php-nginx/php-7.1-ubuntu
      volumes:
        - /Users/marcin/Docker/projects/test.local/html/:/usr/share/nginx/html/
        - /Users/marcin/Docker/projects/test.local/nginx/conf.d/:/etc/nginx/conf.d/
        - /Users/marcin/Docker/projects/test.local/nginx/log/:/var/log/nginx/
        - /Users/marcin/Docker/projects/test.local/supervisor/conf.d/:/etc/supervisor/conf.d/
        - /Users/marcin/Docker/projects/test.local/supervisor/log/:/var/log/supervisor/
        - /Users/marcin/Docker/projects/test.local/cron/:/root/.cron/
        - /Users/marcin/Docker/local_share/:/root/.local_share/
        - /Users/marcin/Docker/local_share/certificates/:/usr/share/nginx/certificates/  
      working_dir: /usr/share/nginx/html/
      links:
        - db
      container_name: test.php
      hostname: test.local
      ports:
        - "336:22"
        - "8081:80"
        - "18080:443"    
      environment:
        - VIRTUAL_HOST=test.local   
        - CERT_NAME=default
        - HTTPS_METHOD=noredirect
    db:
      build: /Users/marcin/Docker/definitions/mysql/5.7
      environment:
         - MYSQL_ROOT_PASSWORD=pass
         - MYSQL_DATABASE=
         - MYSQL_USER=
         - MYSQL_PASSWORD=
      expose:
         - 3306
      volumes:
        - /Users/marcin/Docker/projects/test.local/mysql/data/:/var/lib/mysql/
        - /Users/marcin/Docker/projects/test.local/mysql/conf.d/:/etc/mysql/conf.d/source
        - /Users/marcin/Docker/projects/test.local/mysql/log/:/var/log/mysql/
      ports:
        - "33060:3306"
      container_name: test.db
      hostname: test.local
  </code></pre>
  
  <p>and after that it seems not to work. I can access site using ip and port without a problem, but I cannot longer use domain to access it. When I try I'm getting:</p>
  
  <blockquote>
    <p>503 Service Temporarily Unavailable</p>
    
    <p>nginx/1.13.8</p>
  </blockquote>
  
  <p>And this is for sure from jwilder nginx (and not the nginx in project).</p>
  
  <p>So the question is - where should I put environment variables to make it work? It seems that when they are placed as they are at the moment they are not read by proxy. </p>