[ad_1]
I have defined a subdomain on my local server and I want to request to subdomain from docker container but the container can not resolve the subdomain. local server uses nginx and is not a docker container.
Local nginx config
server {
listen 80;
root /data/www/html/sites/car/public;
index index.php index.html index.htm;
server_name car.localhost;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
Local server hosts – /etc/hosts
127.0.0.1 car.localhost
Curl error in docker container
echo shell_exec("curl http://car.localhost 2>&1");
Fatal error: Uncaught Exception: [0] cURL error 6: Could not resolve host: car.localhost
[ad_2]