Configure NGINX in docker container to network with other docker container app

I have one docker container with nginx (path docker/nginx):

services:

  web:
      image: nginx
      volumes:
           - ./templates:/etc/nginx/templates
      ports:
           - "80:80"
      networks:
           - nginx-net

networks:
        nginx-net:
           name: proxynet
           external: true        
        

And docker with app (docker/app):

services:
  php:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: app_php
    networks:      
      - nginx-net   

networks:
  nginx-net:
    external: true
    name: proxynet

File nginx conf.template


 server {
      listen 80 default_server;
     server_name subdomain.domain.com;
  
  
          location /{
    proxy_pass app_php:80/; 
    }
}

I want nginx to redirect to the app container and to other containers in the future.

But in web browser subdomain.domain.com show 504 error.

ping -c 4 app_php – ping from nginx container is ok

I spent a few hours and I don’t know what the problem is, I suspect nginx conf