What am I missing?

Error from startup: 2016/09/18 13:15:42 /etc/caddy/Caddyfile:5 - Parse error: Unknown directive ‘nextcloud.mydomain.com

:443

tls alex@mydomin.com

nextcloud.mydomain.com {

  log /var/log/caddy/nextcloud_access.log

  root /var/www/nextcloud

  fastcgi / unix:/run/php-fpm/www.sock php {
    env PATH /bin
  }

  rewrite {
    r ^/index.php/.*$
      to /index.php?{query}
  }

  # client support (e.g. os x calendar / contacts)
  redir /.well-known/carddav /remote.php/carddav 301
  redir /.well-known/caldav /remote.php/caldav 301

  # remove trailing / as it causes errors with php-fpm
    rewrite {
      r ^/remote.php/(webdav|caldav|carddav)(\/?)$
        to /remote.php/{1}
    }

  rewrite {
    r ^/remote.php/(webdav|caldav|carddav)/(.+)(\/?)$
      to /remote.php/{1}/{2}
  }

  # .htacces / data / config / ... shouldn't be accessible from outside
  rewrite {
    r  ^/(?:\.htaccess|data|config|db_structure\.xml|README)
      status 403
  }

  header / Strict-Transport-Security "31536000"

}

You’re missing curly braces around your first site definition:

:443 {
    tls alex@mydomin.com
}
```

From the Caddyfile docs:

> To configure multiple servers (virtual hosts) with a single Caddyfile, you must use curly braces around each site block
1 Like

Thanks! Misunderstood a little bit, I think I have it.

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