0

My website will not open without writing www in the URL.

Hosting and DNS servers are in the same machine.

I tried to search, no result. I tried to put dot after test.com in the last line, did not help.

Here is my bind configuration. How can I resolve this? Thank you.

$TTL    604800
@   IN  SOA ns1.test.com. admin.test.com. (
                 15     ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL
;
;@  IN  NS  localhost.
;@  IN  A   127.0.0.1
;@  IN  AAAA    ::1
IN  NS  ns1.test.com.

ns1.test.com. IN A 11.22.33.44 mail.test.com. IN A 11.22.33.45

test.com. IN MX 8 mail.test.com.

www.test.com. IN CNAME ns1.test.com. test.com IN CNAME ns1.test.com.

it dev
  • 315
  • You should indicate what is the symptom : does the Web server reply (something you don’t want like a 404 error), or the browser gives you an error. The DNS configuration looks fine. – Frédéric Loyer Jun 03 '22 at 07:53
  • I'm a little old, but don't you use iptables to forward your port 80? – Philippos Jun 03 '22 at 07:53
  • @FrédéricLoyer, just does not load the page, DNS error. But if I add www, then it loads. – it dev Jun 03 '22 at 07:56
  • @Philippos, there is a redirection in web server configuration. The problem is not in redirecting, problem: wont open without www. – it dev Jun 03 '22 at 07:58
  • Could you try https://www.nslookup.io/ with your domain ? Perhaps their is a cache issue. You also have the nslookup command on your PC. If both interrogations gives you different results, it should be a cache issue. – Frédéric Loyer Jun 03 '22 at 08:00
  • @FrédéricLoyer, it resolves www.test.com, but it cannot resolve test.com – it dev Jun 03 '22 at 08:03
  • hm, your nameserver being the authorative instance to resolve its own address – that's a fragile thing. Also, my DNS is getting a bit rusty, but your zone seems to be ns1.test.com, but you have things outside that zone in your zone file – Marcus Müller Jun 03 '22 at 08:11

1 Answers1

0

The last line is illegal. You can’t have a CNAME record on the root of a DNS zone.

Instead, a common pattern is to CNAME www to the root of the zone, and have the root resolve with A/AAAA.