【发布时间】:2019-09-23 14:43:11
【问题描述】:
我正在设置一个使用 Traefik (v1.7.16) 作为反向代理的 docker-compose 环境,并希望包含 Matomo。我将 Bitnami 图像用于 Matomo 和备份数据库 (MariaDB);两个latest。设置类似于Bitnami's example compose file。
我按照提供的说明进行操作,一切正常,除了使用 Traefik 进行路由。例如。我可以在localhost:<exposedPort> 运行 Matomo,但不能在 localhost/matomo 运行,因此子路径不起作用。
到目前为止我所做的:正如Matomo FAQ 中所解释的,我将环境变量MATOMO_ENABLE_PROXY_URI_HEADER=yes 设置为config.ini.php 中的proxy_uri_header = 1(这可行)。然后我为 Matomo 服务设置 traefik 标签:
labels:
- 'traefik.backend=matomo'
- 'traefik.docker.network=proxy_traefik'
- 'traefik.enable=true'
- 'traefik.frontend.headers.STSPreload=true'
- 'traefik.frontend.headers.STSSeconds=31536000'
- 'traefik.frontend.rule=Host:localhost; PathPrefixStrip:/matomo;'
- 'traefik.frontend.headers.customRequestHeaders=X-Forwarded-Uri:localhost/matomo'
- 'traefik.frontend.headers.hostsProxyHeaders=X-Forwarded-Uri'
- 'traefik.port=80'
因此,我可以加载页面 localhost/matomo,但所有内部 URL(如图像和脚本 URL)仅引用 localhost,不包括路径 /matomo。
在设置 Traefik 和 Matomo 时我有什么遗漏吗?
【问题讨论】:
标签: routing docker-compose traefik bitnami matomo