Caddy Konfigurationsbeispiele
Ein paar kurze Beispiele für den Caddy Webserver.
Subdomain
Anfragen ohne Subdomain auf www umleiten:
unixery.de {
    redir https://www.{host}{uri}
}
Kompression
Vorkomprimierte Dateien ausliefern:
www.unixery.de {
    # Set this path to your site's directory:
    root * /path/to/www.unixery.de
    encode zstd gzip
    # Enable the static file server:
    file_server {
        precompressed zstd br gzip
    }
}
Dateien vorkomprimieren:
# compression
echo "Compressing files with zstd (zst)..."
find public/ -name "*.html" -or -name "*.svg" -or -name "*.css" -or -name "*.js" -or -name "*.xml" -or -name "*.txt" | xargs zstd -f -19
echo "Compressing files with brotli (br)..."
find public/ -name "*.html" -or -name "*.svg" -or -name "*.css" -or -name "*.js" -or -name "*.xml" -or -name "*.txt" | xargs brotli -f -9
echo "Compressing files with gzip (gz)..."
find public/ -name "*.html" -or -name "*.svg" -or -name "*.css" -or -name "*.js" -or -name "*.xml" -or -name "*.txt" | xargs gzip -f --keep
HTTP erlauben
Eine Seite per HTTP statt HTTPS ausliefern:
http://192.168.1.123 {
    # Set this path to your site's directory:
    root * /path/to/www/
    # Enable the static file server:
    file_server
}