N
N
nikolau2019-01-07 13:36:43
Nginx
nikolau, 2019-01-07 13:36:43

Nginx config accessing a site subdomain through a directory?

There is a website site.ru, it has a separate subdomain subdomain.site.ru . It is necessary that when referring to site.ru/subdomain/..., it actually refers to subdomain.site.ru/... . I wrote a request through a proxy, but I think this is not optimal, maybe you can just write a rewrite rule somehow?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
O. J, 2019-01-15
@OrlovEvgeny

location ^~ /subdomain/ {
    rewrite ^/subdomain/(.*) http://subdomain.site.ru/$1 permanent;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question