Server Fault is a question and answer site for system and network administrators. 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'm pretty new to this! I'm trying to redirect my url to my server, so all I did was this :

which consisted of adding a /etc/apache2/conf.d/virtual.conf creating /etc/apache2/sites-available/ and typing a2ensite

on my domain manager, I just redirected the dns to my server IPs.

It didn't work. I contacted my server support that told me I needed to use bind9.

So I tried adding the zones in /etc/bind/named.conf.local:

zone "" {
     type master;
     file "/var/lib/bind/";

then created /var/lib/bind/ as follow :

; BIND reverse data file for broadcast zone
$TTL    604800
@       IN      SOA (
                          1         ; Serial
                     604800         ; Refresh
                      86400         ; Retry
                    2419200         ; Expire
                     604800 )       ; Negative Cache TTL
@       IN      NS

and restarted BIND: /etc/init.d/bind9 restart

Also, a friend told me I didn't have to do this, I just had to add to my /etc/hosts file

none of these are working, help!

share|improve this question
what is the question? – umläute May 21 '12 at 15:50
oups! The problem is it's not working, did I do something wrong? – David 天宇 Wong May 21 '12 at 15:52
what is "not working"? how does the system react and how do you expect it to react? – umläute May 21 '12 at 15:55
iI can't access my website through the URL – David 天宇 Wong May 21 '12 at 15:56
this is not a description of "how the system reacts". it's short of "it doesn't work" which is about the one answer that guarantees that people will stop trying to help...please try to come up with descriptions of the problem that enables others to help you – umläute May 21 '12 at 18:17

1st make sure that you are resolving correctly. (whether you use /etc/hosts, bind, ZoneConf or whatever is secondary) check with:

$ host

you should get the IP of your server (e.g.; and you should be able to ping that machine.

if you don't get anything back, then your resolver is broken. first of all, the example configuration you gave above does not include any lookups. you will need a line like  IN A

change the IP to the one you are actually using. increase the serial-number and reload bind. watch out for any errors. test again. if it doesn't work, try to directly query your nameserver:

$ dig @ip.of.dns.server

if this works, check the nameserver entry in your /etc/resolv.conf it should contain a line like the following (try to avoid additional nameserver entries for now)

nameserver ip.of.dns.server

2nd make sure that apache is running. point your browser to "http://" (it might display the wrong vhost, but it should at least display something)

3rd make sure that your browser resolves the new name correctly point your browser to "", and see what it gets you. note that browsers like firefox will keep their own DNS-cache, so if you try to override an existing DNS entry (e.g. usually resolves to, you might have to restart your web-browser in order to have the new DNS-settings take effect.

4th make sure that apache's vhost is working correctly. if it's not working, turn logging on:

RewriteLog "${APACHE_LOG_DIR}/"
RewriteLogLevel 1

and see what the logs tell you

share|improve this answer
#host Host not found: 2(SERVFAIL) – David 天宇 Wong May 21 '12 at 16:18

An easy solution to your problem would be a simple and free web-based domain manager, which would do all the dirty work (of configuring bind) for you. I personally use ZoneEdit, but I'm sure there are others out there.

If you need further help to setup this, let me know.

share|improve this answer
I'm already using a registar for my domain. – David 天宇 Wong May 21 '12 at 15:56
It's not a registrar! It's a DNS manager! It associates your server IP with your domain name. Afterwards, on your domain registrar website, you will have to add the ZoneEdit name servers, so that your domain also points to your server IP. – Silviu May 21 '12 at 15:59

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.