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: {
	root /srv/
} {
	root /srv/

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/'

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:

Home · caddyserver/caddy Wiki · GitHub

The individual directives are outlined here:

Home · caddyserver/caddy Wiki · GitHub

Your header options are specified with the headers directive:

Home · caddyserver/caddy Wiki · GitHub

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 Welcome — Caddy Documentation - the v2 Caddyfile documentation just hasn’t made its way there quite yet.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

so the solution I came up with looks as follows:, {
    root * /srv/www/{host}/public/

For the full caddyfile have a look on my blog post: How I moved from Nginx to Caddy