Assume the domain name is domain.com
,
How to configure nginx.conf
, so that when accessing abc.domain.com
, it is actually the content of domain.com/abc
(browse The server's address still appears as abc.domain.com
)
The configuration I searched online is useless:
location / {
set $domain default;
if ( $http_host ~* "^(.*)\.domain\.com$") {
set $domain ;
}
rewrite ^/(.*) /$domain/ last;
}
Key part:
Just build another server! It's so complicated, both regular and rewritten.