0

I have very simple config:

server {
    listen       80;
    server_name  test.mydomain.ru;

    location / {
        proxy_pass http://127.0.0.1:8081;
    }
}


server {
    listen       80;
    server_name  *.test2.ru;
index  index.html;

    location / {
        root   html;
    }
}

When I am accessing to test2.ru test.mydomain.ru is opens. Why? *.test2.ru should handle any requests to test2.ru.

Can it be issue with DNS configuration? I have got follow settings:

www A 164.138.29.xxx for test2.ru;

and

test A 164.138.29.xxx for test.mydomain.ru;

1 Answer 1

1

*.test2.ru will only match "something.test2.ru".

You'll need to add both *.test2.ru and test2.ru to the server_name configuration.

Edit: Apparently you can also do the following to match both with a single entry:

A special wildcard name in the form “.example.org” can be used to match both the exact name “example.org” and the wildcard name “*.example.org”.

Also, for just test2.ru to work, you'll need to make sure test2.ru resolves to the IP address. The DNS records you show only cover www.test2.ru and test.test2.ru.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .