gpt4 book ai didi

docker - Traefik + Nextcloud 导致网关故障

转载 作者:行者123 更新时间:2023-12-02 05:07:54 32 4
gpt4 key购买 nike

我有 3 个服务已启动并正在运行。mariadb 和 nextcloud 实例:

version: '2.1'

volumes:
nextcloud:
db:

services:
db:
image: mariadb
volumes:
- db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=my_root_password
- MYSQL_PASSWORD=my_password
- MYSQL_DATABASE=my_database
- MYSQL_USER=my_user
app:
image: nextcloud
restart: always
networks:
- web
- default
ports:
- 9000
labels:
- "traefik.backend=app"
- "traefik.docker.network=web"
- "traefik.frontend.rule=Host:my_host"
- "traefik.enable=true"
- "traefik.port=9000"
- "traefik.default.protocol=http"

networks:
web:
external: true

还有 traefik 服务:

version: '2'

services:
traefik:
image: traefik:1.5.4
restart: always
ports:
- 80:80
- 443:443
networks:
- web
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /opt/traefik/traefik.toml:/traefik.toml
- /opt/traefik/acme.json:/acme.json
container_name: traefik

networks:
web:
external: true

此 traefik 实例正在使用此配置文件:

debug = false

logLevel = "ERROR"
defaultEntryPoints = ["https","http"]

[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]

[retry]

[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "my_host"
watch = true
exposedByDefault = false

[acme]
email = "my_email"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
[acme.httpChallenge]
entryPoint = "http"

现在,当我转到我的主机时,它会重定向到 HTTPS,但随后它只显示 bad gateway 而没有其他内容。它应该显示 nextcloud Web 应用程序。有谁知道为什么会发生这种情况?我正在使用 docker-compose up -d 命令运行撰写文件。

最佳答案

现在可能为时已晚,但我自己也遇到了这个问题,所以发布一个答案来解决我的问题。
Nextcloud 在 Traefik 尝试连接的容器的 IP 地址上公开端口 80。因此,您错误地指定了“traefik.port”标签的端口。将其从 9000 更改为 80。

关于docker - Traefik + Nextcloud 导致网关故障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50362873/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com