Ubuntu | Caddy
Installer Caddy
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curlcurl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpgcurl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.listsudo apt updatesudo apt install caddy
Paramétrer pour Docker
editor /etc/caddy/Caddyfile
Dans le répertoire /etc/caddy
, modifier le fichier Caddyfile.
:80 { # Set this path to your site's directory. # root * /usr/share/caddy
# Enable the static file server. # file_server
# Another common task is to set up a reverse proxy: # reverse_proxy localhost:8080 reverse_proxy :3000
# Or serve a PHP site through php-fpm: # php_fastcgi localhost:9000}
systemctl reload caddy
Pour que les modifications soient effectives, il faut redémarrer caddy.
Nom de domaine
curl "https://cloudflare-dns.com/dns-query?name=example.com&type=A" \ -H "accept: application/dns-json"
:80 { https://exemple.fr { reverse_proxy :3000}
Caddy prend en charge la navigation https.
Redirection wwww
https://www.example.fr { redir https://exampe.fr permanent }https://exemple.fr { reverse_proxy :3000}
Sauvegarder et relancer caddy.
Lighthouse
Pour améliorer les performances de notre site statique, il nous faudra l’encoder. Voici un exemple de configuration avec gzip
.
https://www.example.fr { redir https://exampe.fr permanent}https://exemple.fr { encode gzip reverse_proxy :3000}