DNS configuration 2 domains

  • Posted January 28, 2015


I have one droplet with 2 distinct DNS entries pointing to it. 1800 IN A [ip] 1800 IN NS 1800 IN NS 1800 IN NS 1800 IN CNAME * 1800 IN A [ip] IN SOA 1412268938 10800 3600 604800 1800 1800 IN A [ip] 1800 IN NS 1800 IN NS 1800 IN NS 1800 IN CNAME

my nginx has those 2 configs:

server { server_name; … }

server { server_name; … }

My problem is that , if i go to, nginx leads to my domain2 config.

I tried to play with A and CNAME with no solution, any help?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

If you want to support additional subdomains or have your site act as a catch-all for subdomains in that domain you would want to update your server_name parameter to look like this:

server {
server_name *;

The addition of the * tells nginx to serve requests for any name that ends with

It worked, thank you!

There is not a directive for wildcard subdomains, so you will be answer by first conf in line

server { server_name; … }

server { server_name; … }

it should be something around this lines:

server { server_name; … }

server { server_name; … }