Forum Moderators: phranque

Message Too Old, No Replies

How to redirect unused domain names to parking page?

Whilst working normally? Nameservers that serve a double purpose?

         

rollinj

3:36 pm on Dec 15, 2007 (gmt 0)

10+ Year Member



How do I setup nameservers that will automatically park (point to sedo or another domain parking service) domain names that don't have a cpanel account setup specifically for them?

Is something like this even possible?

It'd just be nice to be able to point EVERY domain I own in godaddy to my only two nameservers and redirect the unused ones automatically.. I assume one can appreciate why!

Thanks!

gergoe

11:01 pm on Dec 15, 2007 (gmt 0)

10+ Year Member



If you configure all domain names in your name server (as you should, once you registered a domain name), then you have to point the www host of each domain to your webserver, and deal with the response there. With Apache it is quite simple, you just need to add one VirtualHost to the top of all other VirtualHosts, give it a name, which will never match (parked.dummy.domain for example), and this VirtualHost will be chosen by the Apache each time a host is requested which does not match any of the other VirtualHosts.

If you do not configure the domains in your dns server, then the dns server must support this feature (return a forged response for non existent domain names), sometimes referred as NXDOMAIN redirect. If you have that in your dns server, then you should configure it to send back the ip address of your webserver and proceed as described above. Please note that if you configure your dns server like this, all requests for non existent domain names will resolve to this ip address, so if someone request the ip address of www.google.com from your dns server, it will finally end up on your webserver...

rollinj

2:32 am on Mar 3, 2008 (gmt 0)

10+ Year Member



Thanks for the tips! However I'm still quite confused :S

I have two nameservers right now.. ns1.mydomain.com and ns2.mydomain.com

how do i set up my apache so that when an account is not active for a given domain.. a default (redirecting) page is shown?

I don't think i should need to add any virtualhosts or extra nameservers.. can I not just show a default page for domains with no account setup?

Thanks in advance!

gergoe

1:47 am on Mar 4, 2008 (gmt 0)

10+ Year Member



To have a page displayed in a browser these things must be there, or they must be "tricked".
  1. The domain name must be registered, the domain name should point to a (set of) DNS servers, and the domain should have the corresponding host entry within the zone.
  2. There must be a webserver (let's stick to Apache now) listening on the ip address (which was resolved from the hostname from the point above), the Apache must have the proper VirtualHost containers defined.

What it means?

  • When you register a domain name at a registrar, they make your domain name in the country wide domain registry, and they make it point to your dns servers.
  • Now, you have to configure this domain name on your dns servers. If you don't do that, nobody over the world will be able to use it in no way.
  • If you have the domain configured in your dns servers, then you can start adding hosts to the domain, typically you want to add www and the 'default' one (www.example.com and example.com). You have to make at least one A record, and then you can use CNAME records pointing to the just created A record. If you do not create any record within your domain (besides of the SOA and NS ones), then user agents will not be able to resolve anything.example.com into an ip address, they will fail to find your webserver.
Now, the last two "steps" can be bypassed for parked domains by making your DNS servers respond with a forged response when the requested domain name is not configured locally. See the second part of my previous post (from last year :-) for that.
  • If the request survived the name resolution (resolved the hostname into an ip address), then your webserver will be contacted by the browser, it will send a http request to your server. Your server should know what to do with the request - more specifically with the hostname indicated in the request. If you already have a VirtualHost defined for that hostname, then the Apache will do its usual job, but if the hostname will not match any of the VirtualHosts, then it will display the default one.

The default one is simply the first VirtualHost defined in your configuration files. So by making a dummy VirtualHost on very top of the other ones, you can display any kind of parked message for domain names (and hosts too), which are not configured in your Apache (and in the cpanel admin) explicitly.

That's the technical explanation of the whole idea, but you have to find out how to implement that (what is possible with your DNS servers, how to make the dummy VirtualHost left intact by cpanel and so on).

I'm not a cpanel user, but if you are looking for an easy solution, then look around cpanel, they might offer this domain parking thing out of the box.