Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am still a newbie when it comes to Linux, and I recently bought 2 domains from NameCheap.

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), if that's of any help.

I have found some lengthy tutorials on YT and elsewhere, but to me they weren't so clear because in every one they are setting up some kind of made up local domain (with Bind9). And 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.

share|improve this question
up vote 2 down vote accepted

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 :)

share|improve this answer
This is exactly what I needed! – Kid Diamond Aug 2 '14 at 12:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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