
Halo, kalau kamu merasa tulisan saya ngebantu kamu, kamu bisa ucapkan terima kasih lewat saweria .
If you feel this website help you, you can donate at saweria .
What I Used in This Tutorial
-
Docker version 24.0.7
-
Traefik v2.10.5
-
Image trafex/php-nginx:3.4.0
How To
-
Clone plugin-simplecache dari traefik
git clone https://github.com/traefik/plugin-simplecache plugins-local/src/github.com/traefik/plugin-simplecache
-
Buat file
docker-compose.yml
# docker-compose.yml version: "3.8" services: traefik: image: traefik:v2.10.5 container_name: traefik-ctr command: # - --log.level=DEBUG - --api - --api.dashboard - --api.insecure=true - --providers.docker=true - --entrypoints.web.address=:80 - --experimental.localPlugins.plugin-simplecache.modulename=github.com/traefik/plugin-simplecache ports: - "80:80" - "8080:8080" networks: - traefik-network volumes: - /var/run/docker.sock:/var/run/docker.sock - ./plugins-local/src/github.com/traefik/plugin-simplecache:/plugins-local/src/github.com/traefik/plugin-simplecache - ./cache:/cache labels: - traefik.http.middlewares.my-cache.plugin.plugin-simplecache.path=/cache - traefik.http.middlewares.my-cache.plugin.plugin-simplecache.addStatusHeader=true php-nginx: image: trafex/php-nginx:3.4.0 container_name: php-nginx-ctr depends_on: - traefik networks: - traefik-network labels: - traefik.enable=true - traefik.http.routers.nginx.rule=Host(`localhost`) - traefik.http.routers.nginx.entrypoints=web - traefik.http.routers.nginx.middlewares=my-cache - traefik.http.services.nginx.loadbalancer.server.port=8080 networks: traefik-network: driver: bridge
-
Deploy dengan
docker compose up -d
. Tunggu beberapa saat docker akan pull image di atas dan deploy trafex/php-nginx (ini butuh waktu buat deploy nya)

Deployment Sukses

Halaman test.html Ini akan Digunakan Untuk Cache Test
- Test cache dengan
curl -I localhost

Cache Setup Sukses

Cek Direktori Cache, Ini Familiar Buat Yang Sering Pake Nginx Cache
Referensi: