OS: macOS 11.5.2 (20G95)
NGINX запущен как контейнер, порты привязаны к хосту
ports:
- target: 80
published: 80
protocol: tcp
mode: host
- target: 443
published: 443
protocol: tcp
mode: host
в конфигурации определен сервер
http {
server {
listen 443 quic;
listen 443 ssl http2;
server_name web_app.localhost;
...
}
}
Если в браузере указать URL - https://web_app.localhost - ,браузер корректно разрешает имя и отображает страницу
Если в терминале выполнить - curl https://web_app.localhost - получим ошибку: curl: (6) Could not resolve host: web_app.localhost
/etc/host:
-------------------------------------------------------------------------------
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
/etc/resolv.conf :
------------------------------------------------------------------------------------------------------
#
# macOS Notice
#
# This file is not consulted for DNS hostname resolution, address
# resolution, or the DNS query routing mechanism used by most
# processes on this system.
#
# To view the DNS configuration used by this system, use:
# scutil --dns
#
# SEE ALSO
# dns-sd(1), scutil(8)
#
# This file is automatically generated.
#
nameserver 192.168.0.1