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/www.example.com and typing a2ensite www.example.com

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 "lyon01.com" {
     type master;
     file "/var/lib/bind/example.com";

then created /var/lib/bind/example.com as follow :

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

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 example.com to my /etc/hosts file

none of these are working, help!

  • 1
    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 lyon01.com

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

lyon01.com.  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 lyn01.com @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 "http://lyon01.com", 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. example.com 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}/lyon01.com-rewrite.log"
RewriteLogLevel 1

and see what the logs tell you

  • #host lyon01.com Host lyon01.com 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.

  • 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 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.