M
M
Michael2019-01-21 18:22:58
Nginx
Michael, 2019-01-21 18:22:58

How to make an alias for a subdomain?

There are 2 domains: example.com, subdomain.example.com. Both work, everything is set. You need to make subdomain.example.com open from example.com/subdomain, so that paths for files work without taking into account the first directory, i.e. the subdomain itself, /subdomain/.
It doesn't work like this:

location /subdomain {
    root /var/www/subdomain.example.com;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2019-01-21
@springimport

Understood. There may be other ways, but this seems to be the simplest:

location /subdomain {
    alias /var/www/subdomain.example.com;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question