By Walid ETTAYEB

Qu'est-ce que le Caddy ?

Caddy a un large éventail de cas d'utilisation, incluant :

  • Web Server
  • Reverse Proxy
  • Sidecar Proxy
  • Load Balancer
  • API Gateway
  • Ingress Controller
  • System Manager
  • Process Supervisor
  • Task Scheduler

Aujourd'hui, nous allons installer et configurer Caddy en tant que Reverse Proxy.

Installation

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy

Configuration du reverse proxy

  1. Crée un fichier "Caddyfile"
nano Caddyfile
  1. Utilisez le modèle suivant:
example.com {
    reverse_proxy 127.0.0.1:8080
}
  1. Relancez Caddy et intégrez la nouvelle configuration
caddy reload

Une fois la nouvelle configuration chargée, un certificat Let's Encrypt HTTPS est automatiquement généré pour le domaine. Assurez-vous simplement que l'enregistrement A pointe vers le serveur Caddy !

Paramètres supplémentaires
  • Load Balancing
  • Active Health Checks
  • Passive Health Checks
  • Streaming
  • Header Manipulation
  • Transport

Voilà, c'est fini !

Walid ETTAYEB • 36 Articles

Passionné par l'informatique depuis mon plus jeune âge, je transforme ma passion en expertise.

View Articles