title: `NGINX` reverse proxy does not work in `DOKCER` (502 bad gateway)
body: <p>I have a VPS, my problem is that <code>proxy_pass</code> does not work, I get the <code>502 badgateway</code>([error] 23#23: *1 connect() failed (111: Connection refused) while connecting to upstream,)</p>
  <p>I saw similar questions but each case is different, please help me if you can.</p>
  <p>The following is my configs:</p>
  <p><strong>NGINX (default.conf)</strong></p>
  <pre><code>server {
    listen 80 default_server;
    server_name _;
  
    location /account {
      proxy_pass http://my_app_api:7000/account/;
    }
  
    location /info {
      return 200 &quot;MHF&quot;;
      default_type text/plain;
    }
  }
  </code></pre>
  <p><strong>docker-compose.yml</strong></p>
  <pre><code>version: &quot;2.4&quot;
  
  networks:
    # internal:
    web:
      external:
        name: my-app-network
  
  services:
    my_app_api:
      build: .
      container_name: my-app-container
      env_file: .env
      restart: always
      stop_grace_period: 2m
      networks:
        - web
      ports:
      - 7000:7000
      depends_on:
        - db
      environment:
        DB_HOST_LOCAL: $DB_HOST_LOCAL
        CHALLENGE_CODE_MIN: $CHALLENGE_CODE_MIN
        CHALLENGE_CODE_MAX: $CHALLENGE_CODE_MAX
      logging:
        driver: json-file
        options:
          max-size: '12m'
          max-file: '2'
  
    db:
      image: mongo:4.0
      container_name: db_mongo
      env_file: .env
      restart: always
      stop_grace_period: 2m
      networks:
        - web
      environment:
        MONGO_DB_URI_LOCAL: $MONGO_DB_URI_LOCAL
        MONGO_DB_NAME: $MONGO_DB_NAME
        ME_CONFIG_MONGO_DB_USERNAME: $ME_CONFIG_MONGO_DB_USERNAME
        ME_CONFIG_MONGO_DB_PASSWORD: $ME_CONFIG_MONGO_DB_PASSWORD
      volumes:
        - ./my-app-db:/data/db
      ports:
          - 27017:27017
  
    nginx:
      image: nginx:latest
      container_name: nginx-container
      restart: always
      networks:
        - web
      depends_on:
        - my_app_api
      ports:
        - 80:80
      volumes:
        - type: bind
          source: ./nginx/default.conf
          target: /etc/nginx/conf.d/default.conf
          read_only: true
      logging:
        driver: json-file
        options:
          max-size: '12m'
          max-file: '2'
  </code></pre>
  <p><strong>Dockerfile</strong></p>
  <pre><code>FROM node:latest
  
  # Create app directory &amp; cd /app
  WORKDIR /app
  EXPOSE 7000
  
  # Install app dependencies
  COPY package.json yarn.lock ./
  
  COPY .env .
  
  # Install dependency
  RUN yarn
  
  # Bundle app source
  COPY . .
  
  CMD [&quot;yarn&quot;, &quot;start:debug&quot;]
  </code></pre>