[英]docker nginx reverse proxy 503 Service Temporarily Unavailable
I want to use nginx as reverse proxy for my remote home automation access.我想使用 nginx 作为远程家庭自动化访问的反向代理。
My infrastructure yaml looks like follows:我的基础设施 yaml 如下所示:
# /infrastructure/docker-compose.yaml
version: '3'
services:
proxy:
image: jwilder/nginx-proxy:alpine
container_name: proxy
networks:
- raspberry_network
ports:
- 80:80
- 443:443
environment:
- ENABLE_IPV6=true
- DEFAULT_HOST=${RASPBERRY_IP}
volumes:
- ./proxy/conf.d:/etc/nginx/conf.d
- ./proxy/vhost.d:/etc/nginx/vhost.d
- ./proxy/html:/usr/share/nginx/html
- ./proxy/certs:/etc/nginx/certs
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/tmp/docker.sock:ro
restart: always
networks:
raspberry_network:
My yaml containing the app configuration looks like this:我的 yaml 包含应用程序配置如下所示:
# /apps/docker-compose.yaml
version: '3'
services:
homeassistant:
container_name: home-assistant
image: homeassistant/raspberrypi4-homeassistant:stable
volumes:
- ./homeassistant:/config
- /etc/localtime:/etc/localtime:ro
environment:
- 'TZ=Europe/Berlin'
- 'VIRTUAL_HOST=${HOMEASSISTANT_VIRTUAL_HOST}'
- 'VIRTUAL_PORT=8123'
deploy:
resources:
limits:
memory: 250M
restart: unless-stopped
networks:
- infrastructure_raspberry_network
ports:
- '8123:8123'
networks:
infrastructure_raspberry_network:
external: true
Via portainer I validated that both containers are contected to the same network.通过搬运工,我验证了两个容器都连接到同一个网络。 However, when accessing my local IP of the raspberry pi 192.168.0.10 I am receiving "503 Service Temporarily Unavailable".但是,当访问我的树莓派 192.168.0.10 的本地 IP 时,我收到“503 服务暂时不可用”。
Of course when I try accessing my app via the virtual host domain xxx.xxx.de it neither works.当然,当我尝试通过虚拟主机域 xxx.xxx.de 访问我的应用程序时,它也不起作用。
Any idea what the issue might be?知道问题可能是什么吗? Or any ideas how to further debug this?或者任何想法如何进一步调试?
You need to specify the correct VIRTUAL_HOST
in the backends environment variable and make sure that they're on the same network (or docker bridge network)您需要在后端环境变量中指定正确的VIRTUAL_HOST
并确保它们在同一网络上(或 docker 桥接网络)
Make sure that any containers that specify VIRTUAL_HOST
are running before the nginx-proxy
container runs.确保在nginx-proxy
容器运行之前指定VIRTUAL_HOST
的所有容器都在运行。 With docker-compose
, this can be achieved by adding to depends_on
config of the nginx-proxy
container使用docker-compose
,这可以通过添加到nginx-proxy
容器的depends_on
配置来实现
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.