Separate nginx and php containers working with 2 separate php services

Hello community,

i have docker-compose.yml with content:
nginx:
build: ./nginx/
ports:
- 80:80
links:
- php
volumes:
- ./code:/var/www/
- ./nginx/api.local.conf:/etc/nginx/conf.d/api.local.conf
- ./nginx/site.local.conf:/etc/nginx/conf.d/site.local.conf
php:
build: ./php/
expose:
- 9000
volumes:
- ./code/api:/var/www/api
- ./code/site:/var/www/site

on my local machine i can get all hosts separate site.local & api.local
but i have one problem and can’t resolve it:
there in php requests from site.local to api.local, so i get errors like this:
cURL error 6: Could not resolve host: api.local

could anybody help me? thanks.