Hello,

I have a server on which I host my firstdomain.com. For this I created a name servers:

Now I would like to host a second domain on that server and to use the same nameserves. I know that is posible (is the solution used in shared-hosting). To do so, I created a Virtual Host:

NameVirtualHost *:80
<VirtualHost *:80>
        DocumentRoot /var/www/second
        ServerName www.seconddomain.com
        ServerAlias second.com
    <Directory /var/www/second>
        Order deny,allow
        Allow from all
        AllowOverride All
    </Directory>
</VirtualHost *:80>

My question is: How do I configure the DNS server to map seconddomain.com to the nameserver? (When I registered the domains at godaddy.com I specified this nameserver).
Sorry for my bad english. Thank you

Dani AI

Generated

Short summary: the Apache VirtualHost shown in the thread is fine; what still needs to be done is proper DNS delegation and a matching zone on the nameserver. As pointed out, seconddomain.com must be served by a primary zone on the DNS server, and the registrar must have a host (glue) record for ns.firstdomain.com that points to the server IP before the domain is delegated. The redundancy point from and is valid — a single nameserver works but reduces resiliency; ’s question about server/version is relevant only when applying server-specific commands.

Checklist of practical actions:

  • Register a host (glue) record at the registrar that maps ns.firstdomain.com to the server IP, then set seconddomain.com’s authoritative nameserver to ns.firstdomain.com at the registrar.
  • On the DNS server, add a primary zone for seconddomain.com with NS and A records (an A for the nameserver and A records for @ and www).
  • Ensure UDP/TCP port 53 is allowed through any firewall and that the DNS daemon is running and answering queries from the internet.
  • If the registrar requires two nameservers and there is only one physical server, either create a second hostname (ns2) and register it (less robust if on same IP) or use an external secondary DNS provider.

Example minimal zone (adapt names/IPs/serial to the setup):

$TTL 86400
@   IN SOA ns.firstdomain.com. admin.firstdomain.com. ( YYYYMMDD01 3600 600 604800 86400 )
    IN NS ns.firstdomain.com.
ns  IN A 198.51.100.10
@   IN A 198.51.100.10
www IN A 198.51.100.10

Quick troubleshooting steps:

  • Use dig NS seconddomain.com and dig @ns.firstdomain.com A www.seconddomain.com to verify delegation and answers.
  • If delegation fails, confirm the registrar’s host/glue entry exists before the NS change, check firewall rules for port 53, and inspect the DNS server logs for zone-load errors.
  • Expect DNS propagation/TTL delays after making changes.

Recommended Answers

All 4 Replies

which server version r u using?

You should have to have atleast two nameservers assigned to single server so if one nameserver fails there would be second one to respond to

Besides each nameserver has to be assigned an dedicated IP

Hope that helps

So you have a DNS server that is hosting and you associated this domain with ns.firstdomain.com. so on that dns server create another primary zone for seconddomain.com. when you register this domain with godaddy, associate this domain with as well.

Normally, registrars want for you to specificy at least two NS servers that will be hosting your domain. having more than one NS server will improve the availability and fault tolerance of your DNS infrastructure.

You should have to have atleast two nameservers assigned to single server so if one nameserver fails there would be second one to respond to

Besides each nameserver has to be assigned an dedicated IP

Hope that helps

Hi,
I agreed too, because as much I knew, one have to specificy at least two DNS servers that will be hosting your domain, having more than one server will improve the availability and fault tolerance of your DNS infrastructure.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.