What is the difference between the following? Both work the same way from what I can tell/use it for
$HTTP["host"] =~ "a.domain.com" {
server.document-root = "/var/www/a/"
}
$HTTP["host"] == "a.domain.com" {
server.document-root = "/var/www/a/"
}
Would the =~
match x.a.domain.com
?
The right-hand side of =~
is a regular expression.
x.a.domain.com
would not match the regular expression a.domain.com
.
Examples that would match:
axdomain.com
axdomainxcom
aydomainycom
a1domain1com
Is the example from a real-world example? It seems kinda pointless.
Something like this could be more meaningful:
$HTTP["host"] =~ ".*\.somedomain\.com" {
server.document-root = "/var/www/somedomain.com/"
}
Meaning, serve all requests to *.somedomain.com from /var/www/somedomain.com/
This page has some more realistic examples with regex matching: