Caddy2 with multiple domains

1. My Caddy version (caddy -version):

v2.0.0-beta10 h1:MkLEoR4kj30H90sZ4YBg9O7sd4Zrl77H0m3mW9gyEmE=

2. How I run Caddy:

Via systemctl start caddy on Fedora 31:
ExecStart=/usr/bin/caddy run --config /etc/caddy/Caddyfile --adapter caddyfile

a. System environment:

Fedora 31
Caddy2 installed via official caddy2 copr.

d. My complete Caddyfile:

nullday.de {
	root /srv/nullday.de/
}

nspawn.org {
	root /srv/nspawn.org/
}

3. The problem I’m having:

❯ caddy validate -adapter caddyfile -config Caddyfile
validate: parsing caddyfile tokens for 'root': Caddyfile:28 - Error during parsing: Wrong argument count or unexpected line ending after '/srv/nullday.de/'

4. What I want to achieve

I want to migrate my existing nginx configuration (two websites, with a lot headers, ssl options, etc) to caddy2. Sad, that serving two websites don’t work already. I thought this would be the easiest part.

If everything works I would like to make a blog post about caddy2.

Ok looks like it’s root [matcher] <path>, the documentation on github seems deprecated :frowning:

But I have still issues with my headers and other ssl options. No idea how I could add them…

Hi @shibumi, welcome to the Caddy community.

The documentation for the v2 Caddyfile is here:

https://github.com/caddyserver/caddy/wiki/v2:-Documentation#caddyfile-adapter

The individual directives are outlined here:

https://github.com/caddyserver/caddy/wiki/v2:-Documentation#caddyfile-directives

Your header options are specified with the headers directive:

https://github.com/caddyserver/caddy/wiki/v2:-Documentation#headers

I’m not sure which SSL options you’re referring to.

Note also that those Github links to the documentation are being made obsolete as it’s all starting to move to the main site at https://caddyserver.com/docs/ - the v2 Caddyfile documentation just hasn’t made its way there quite yet.

1 Like