-2

I want to have 2 DNS pointing to single IP on different ports. Please let me known if it possible. DNS 1 - abc.mydomain.com DNS 2 - xyz.mydomain.com What could be possible solution here. Can nginx help me on this. Our DNS provider is godaddy

MMA
  • 355
  • 3
  • 7
  • 16

3 Answers3

4

Yes, you can point names to specific port numbers by using SRV records.

However many popular protocols including DNS, HTTP, HTTPS, and SMTP do not make use of SRV records. All of those protocols specify the domain name inside the protocol itself such that it is possible to have a single listening port service many domain names.

If you want to use protocols which neither supports SRV records nor specify a hostname inside the protocol itself you have to get a separate IP address for each name.

kasperd
  • 29,894
  • 16
  • 72
  • 122
2

You can point as many DNS A records to an IP address as you want.

In addition, nginx can be configured to listen on different ports, but it will also handle virtual hosts for HTTP so can listen for for different DNS hostnames on the same port.

Simon Greenwood
  • 1,343
  • 9
  • 12
1

DNS resolution has nothing to do with ports. It just resolves names to ip addresses. You need to make sure that GoDaddy allows you to create third level domains. If so, you should be able to create A records for abc.mydomain.com and xyz.mydomain.com pointing to the same ip address.

If you need to host multiple websites using a single ip addres you can do it without dealing with ports: you just need to set up virtual hosts.

If you need two separate instances of Nginx answering on different ports and need some guidance, you can check this: https://stackoverflow.com/questions/36586326/nginx-multiple-php-sites-on-different-ports-on-1-server

Px2016
  • 109
  • 4