Hugo & caddy

The most braindead and amazing web server ever made.

Config table

Thing Place
caddy config file /etc/caddy/Caddyfile
ssl /etc/caddy/ssl
website content specified in caddy file

That’s it. It handles SSL on its own so no need to worry about that either tbh.

Caddy file structure

Serving local files

}
domain1.com, domain2.com {
  root * /var/www/anyname
  file_server
}

Reverse proxy

poo.domain.com {
        encode zstd gzip

        reverse_proxy 10.0.0.2:3000 {
                flush_interval -1
                transport http {
                        dial_timeout 10s
                        response_header_timeout 300s
                }
        }

        header {
                Strict-Transport-Security "max-age=31536000"
                -Server
        }

        log {
                output file /var/log/caddy/git.access.log {
                        roll_size 50MiB
                        roll_keep 5
                }
                format json
        }
}
Line Purpose
encode zstd gzip enables gzip encoding
flush_interval Defines length of response buggering. -1 disables after each write to the client.
10.0.0.2 PEER IP address