2

I am trying to configure Caddy FastCGI with multiple virtual hosts. As far as I can tell the following Caddyfile should be working:

gzip
tls support@mydomain.com
errors /var/log/caddy/error.log

header / Strict-Transport-Security "max-age=15768000;"

portal.mydomain.info {
    fastcgi / 127.0.0.1:3000 {
        root /var/www/portal
        ext .php
        index index.php
    }
}

urlf.mydomain.info {
    fastcgi / 127.0.0.1:3001 {
        root /var/www/urlf
        ext .php
        index index.php
    }
}

But Caddy is failing to start with error:

Feb  2 04:33:58 ip-172-31-24-38 caddy[3135]: 2018/02/02 04:33:58 /etc/caddy/Caddyfile:7 - Error during parsing: Unknown directive 'portal.mydomain.info'
Justin
  • 42,716
  • 77
  • 201
  • 296

1 Answers1

2

From the Caddyfile tutorial:

The first line of the Caddyfile is always the address of the site to serve.

So you'll need to restructure your Caddyfile so all directives are inside a site definition. Here's a page describing the syntax in more technical (and visual) detail.

Matt
  • 22,721
  • 17
  • 71
  • 112