title: Configure NGINX in docker container to network with other docker container app
body: <p>I have one docker container with nginx (path docker/nginx):</p>
  <pre><code>services:
  
    web:
        image: nginx
        volumes:
             - ./templates:/etc/nginx/templates
        ports:
             - &quot;80:80&quot;
        networks:
             - nginx-net
  
  networks:
          nginx-net:
             name: proxynet
             external: true        
          
  </code></pre>
  <p>And docker with app (docker/app):</p>
  <pre><code>services:
    php:
      build:
        context: .
        dockerfile: Dockerfile
      container_name: app_php
      networks:      
        - nginx-net   
  
  networks:
    nginx-net:
      external: true
      name: proxynet
  </code></pre>
  <p>File nginx conf.template</p>
  <pre><code>
   server {
        listen 80 default_server;
       server_name subdomain.domain.com;
    
    
            location /{
      proxy_pass app_php:80/; 
      }
  }
  
  </code></pre>
  <p>I want nginx to redirect to the app container and to other containers in the future.</p>
  <p>But in web browser subdomain.domain.com show 504 error.</p>
  <p><code>ping -c 4 app_php</code>  - ping from nginx container is ok</p>
  <p>I spent a few hours and I don't know what the problem is, I suspect nginx conf</p>