A Catchall / default page for all domain names without entering them as an Alias

3 posts / 0 new
Last post
#1 Sat, 05/14/2016 - 03:24
wozie

A Catchall / default page for all domain names without entering them as an Alias

Hi,

I have been browsing around and on the lookout for an answer on this for a while now and finally plucked up the courage to be able to take the flames and post on this forum to ask it.

Im running VirtualMin, have been for a few years now and I would like to find out how to setup a kind of "Default domain" (but not a default domain for the IP address, but for all names pointing to the nameserver of the server) that all my un-hosted domain names display when the domain name is entered into a visitors browser. (The web page will be a "Domain for sale" kind of page with some contact information on).

Except, I dont want to add an alias for each domain I own as this would take a long time to do, clutter things up and would constantly need updating as some names expire or as I register new domain names.

I will associate my server's nameserver to the domain name to gather the traffic and point it to my server. This will be the same for each domain name and is already setup and running for my current VirtualHosts.

I have Checked the "Default domain for IP address" which is self explanatory, enter the IP address and I get this default website, ok for the IP address.

So, how do I do it? Its a kind of wildcard BIND configuration? I have done this before (on my previous server) and it worked well, but it was a case of hacking and slashing at the BIND / Apache configuration until it worked. (The old server has been retired now as it was running for several years with old setups/OS/etc... so i have started fresh and want everything to be setup correctly from the start).

At the moment I get an Unknown Host / Server Not Found when I setup a domain name as above.

Many thanks and regards, Wozie

Tue, 05/24/2016 - 04:19
Joe
Joe's picture

The "Default domain for IP address" simply makes the domain the first in the list of domains for the IP:port combination specified. This is what Apache treats as "default"; it'll match when nothing else matches more specifically.

You should just need DNS A records for any names you want to be served that website. No "hacking and slashing", but you will need a zone and A record for every domain you want to host on the server...no way around that.

All that said, I'd recommend you use the command line API to create aliases for these domains (then all you need is a text file with one domain per line and a for loop to operate on each line). That'll take care of creating the DNS zone, and setup Apache to server the website you want. You could do something like:

for i in `cat domains-list.txt`; do
    virtualmin create-domain --alias default-domain.com --domain $i
done

I think something like that will do it (this is untested).

If you don't want to create aliases, Webmin's BIND DNS module has the ability to create zones and records from a batch file. Very easy to use, just read the inline help.

Once you have your zones and A records, if you're still not getting the results you want, let us know what the results are and what errors you get in the logs.

--

Check out the forum guidelines!

Tue, 06/28/2016 - 03:45
wozie

Many thanks for your reply, shame there is no kind of catchall for all domain names pointed to my namesevers, but I suppose this stops rogue domain names pointing to my server that could potentially reducing my host's IP SEO score. (FYI I did have this working on my previous host by bastardising the BIND config files).

Anyhoo, I had to add the --default-features switch to the above command you posted, so it is now:

for i in `cat domains-list.txt`; do
     virtualmin create-domain --domain $i --alias example.com --default-features
done
Topic locked