version: '3.7'
services:
traefik:
image: traefik:v2.2.7
container_name: traefik
labels:
.
.
.
// paste on the last line to enable gzip compression
- "traefik.http.routers.traefik.middlewares=traefik-compress"
- "traefik.http.middlewares.traefik-compress.compress=true"
打开你的容器的docker-compose.yml并添加以下行:
version: '3.7'
services:
your_container_name:
labels:
.
.
.
// paste on the last line to enable gzip compression
- "traefik.http.middlewares.your_container_name_compress.compress=true"
- "traefik.http.routers.your_container_name.middlewares=your_container_name_compress"
1条答案
按热度按时间0ejtzxu11#
我认为这是启用gzip的最简单的方法。
打开Traefik v2
docker-compose.yml
并添加以下行:打开你的容器的docker-compose.yml并添加以下行:
然后,运行两个
docker-compose.yml
文件。您也可以将此解决方案作为Gist:https://gist.github.com/fatihyildizhan/e1d9d909049f0a67a7d1585468193438
完整Traefik v1和v2安装指南与Let's Encrypt:https://gist.github.com/fatihyildizhan/8f124039a9bd3801f0caf3c01c3601fb
2023年5月18日更新:
Docker 23 + Traefik 2.9.10 and v1.7 + Let's Encrypt + Github Registry V2 ghcr.io