Answer the question
In order to leave comments, you need to log in
How to make http request between two sites in laradock?
There are two laravel projects in docker (laradock) according to the scheme "one laradock - many projects"
|-- www/
|-- laradock/
|-- one/
|-- two/
// /etc/hosts
127.0.0.1 one.test
127.0.0.1 two.test
// laradock/nginx/sites
one.conf
two.conf
Answer the question
In order to leave comments, you need to log in
I won’t say specifically about the laradok, but I’ll explain how it generally works.
When containers run on the same network, they are accessible to each other by domains that are equal to the name of the container. When running via docker-compose, it's a bit different. Containers see each other by service names.
Those. if you have this docker-compose.yml
services:
front:
image: ....
back:
image: ....
file_get_contents("http://back:8080/path/to/file.txt");
services:
front:
hostname: site1.ru
image: ....
back:
hostname: site2.ru
image: ....
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question