Is there such thing as a default domain? Why is everything redirecting here? O.o

4 posts / 0 new
Last post
#1 Mon, 08/19/2013 - 18:21
decay

Is there such thing as a default domain? Why is everything redirecting here? O.o

I have a virtualmin setup thats running great for most parts. But something i found to be strange was this.

For conversation sake, lets say server ip is 10.20.30.40, server FQDN (A record points to the ip) is server.domain.com, nameservers are ns1/ns2.domain.com. domain.com dns is at cloudflare (A records for above names are pointed to 10.20.30.40).

now, on this server i have otherdomain.com hosted (ns's for this domain is the ns1/ns2.domain.com). and same with mypersonaldomain.com (also hosted here).

now, for some reason, when i type server.domain.com to my address bar, it sort of displays mypersonaldomain.com. if i add any other sites to cloudflare and points an A record to this ip and navigate to that A record domain (before the domain is actually setup on virtualmin), it displays mypersonaldomain.com.

Also, another strange thing i noticed was, mail.otherdomain.com also shows mypersonaldomain.com.

Is there some settings that i need to set? Is this expected behavior (seems strange to me)?

Mon, 08/19/2013 - 21:33
andreychek

Howdy,

If a domain isn't added into Apache, but someone browses to that particular domain -- Apache doesn't know what to do, and will simply display the "Default" domain on that server.

You can set which domain is the default by going into Server Configuration -> Website Options, and there you can set "Default website for IP address".

-Eric

Mon, 08/19/2013 - 21:47 (Reply to #2)
decay

Sweet, makes perfect sense...

Wasent aware that you could set default domain. Thanks for that, ill try that now :)

i expected it to show some 404 or something along those lines... isnt that what you would normally expect?

Tue, 08/20/2013 - 06:19
Locutus

Apache indeed can be somewhat confusing in that regard, yeah. It's their philosophy to say, with name-based virtual hosts, whenever the server gets a request for an unknown host, the alphabetically first defined host is served instead. They probably consider that preferrable over throwing a 404 error.

Might be somewhat of a historical development too, since initially Apache only supported IP-based virtual hosting (i.e. one website per IP).

Topic locked