I recently bought two domains from NameCheap.

I am running a LEMP stack on Debian 7 and want to know how I can create name servers like ns1.example.com and ns2.example.com on my server, because that's what I need to set in my domain settings for them to point to my server.

I am using Google's public DNS name resolver and (in my resolv.conf file), in case that's of any help.

I have found some lengthy tutorials on YouTube and elsewhere, but they weren't so clear to me because in every one they are setting up some kind of made up local domain (with Bind9). And I haven't found anything that handles setting up name servers and making registered domains point to the server.

If anybody could explain to me how I could achieve this (so that example1.com points to, let's say, [ip]/site_dir1), or tell me what I need to be searching for to get this done, it would be greatly appreciated.

1 Answer 1


There is nothing magical with Bind : to manage your own DNS (that is, on your own server), you will need a DNS server such as Bind which will serve as the Authoritative Name Server for your domain. As far as I'm concerned, I find this video from DNS Made Easy rather good when it comes to explaining how DNS works (except maybe the registrar part which goes far too fast).

In a few steps :

  • Set up bind on your machine.
  • Create bind configuration and zone files for your domain.
  • Configure your domain (through your registrar) to use this server. You may want to have a look here.

Concerning Bind configuration on Debian, you'll find an unbelievable amount of documentation on the web. Starting here, and here, and here, and here... But let's be clear : setting up DNS servers can take some time, especially the first time.

Another component will also be needed if you want to match your domains (and subdomains) to web contents : a web server. You will need to have a look at Apache Virtual Hosts.

Unix & Linux cannot provide you with a full Bind (and Apache) tutorial, that would make your question far too broad. We can give you the big picture, now you need to study all its parts :)

  • This is exactly what I needed! Aug 2, 2014 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.