docker compose multiple projects

I want to set up local DOCKER env for multiple projects under the same network. I want to have the main docker-compose config file which will create Nginx proxy and PHP container. And many child docker-compose files with own Nginx. I want all child Nginx containers listen to the main PHP container. But for some reason, child Nginx containers failing with error host not found in upstream "app-php" in /etc/nginx/vhost.d/site.cong25

main docker-compose:

version: '3.5'

services:
  app-nginx_proxy:
    build: ./nginx-proxy
    image: app/nginx-proxy:latest
    container_name: app-nginx_proxy
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
    networks:
      - appnetwork
  app-php:
    image: app/php:latest
    container_name: app-php
    build:
      context: ./php-fpm
      dockerfile: Dockerfile
    expose:
      - 9000
    volumes:
      - app_volume:/var/www/
    networks:
      - appnetwork
volumes:
  app_volume:
    driver: local
    driver_opts:
      type: bind
      device: "$PWD/../services"
      o: bind
networks:
  appnetwork:
    driver: bridge

and child docker-compose:

version: '3.5'

services:
  app-admin-nginx:
    build: ./nginx
    image: app-admin/nginx:latest
    container_name: app-admin-nginx
    volumes:
      - app_admin_volume:/var/www/app-admin
    networks:
      appnetwork:
        aliases:
          - app-admin.v2.local
    environment:
      - VIRTUAL_HOST=app-admin.v2.local
volumes:
  app_admin_volume:
    driver: local
    driver_opts:
      type: bind
      device: "$PWD/../services/app-admin"
      o: bind
networks:
  appnetwork:
    external: true

also, site.conf:

server {
    listen 80;
    server_name app-admin.v2.local;

    root /var/www/app-admin/web;

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_log /var/log/nginx/abboom_admin_error.log;
    access_log /var/log/nginx/abboom_admin_access.log;

    error_page 404 /index.php;

    sendfile off;

    location ~ .php$ {
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        fastcgi_pass app-php:9000;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_index index.php;
    }

    location ~ /.ht {
        deny all;
    }
}

If I move all configs to the single docker-compose file all is working fine, but it’s not flexible to use a single file, as I want add the ability for developers to run only apps they need and not all the app we have

Source: StackOverflow