How to set different root for subdomains:

I am trying to set different root for serving different html for different subdomains. But Caddy do not support different root. And if I set root for second subdomain first stop working.

How to fix it?

sub1.example.com {
    root * /var/www/sub1
    file_server {
        index index.html
    }
}

sub2.example.com {
    root * /var/www/sub2
    file_server {
        index index.html
    }
}

This is not true. Please fill out the template, show logs, and full config.

1 Like

Please never say “stops working”. That doesn’t mean anything. The problem space is infinite.

Show the actual behaviour. Show a request with curl -v. Show your logs.

Please fill out the help topic template as per the forum rules.

1 Like

Sorry, please close topic. It was my error.

What was the problem?

2 Likes

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