Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a dedicated Linux server with The Planet / Softlayer. I need to set up some kind of automation so when a domain is pointing to my server it should automatically display default html page, unless I have added the domain in my Cpanel to point a website.

For example when I book a domain like www.1234.com I want to put in ns1.myserver.com and ns2.myserver.com as it's name servers.

Then when someone goes to www.1234.com it will open a default page on my server automatically without adding it to my cpanel.

In the future if I add www.1234.com and point it to a folder then it should open the website and not the default page.

Is there any way to do this?

share|improve this question
add comment

1 Answer

First thing is, when you point the domain example.com to ns1.yourserver.com/ns2.yourserver.com , you must add the DNS in your nameservers. Otherwise the domain won't resolve. So, it is mandatory that you add the DNS for your domain in your server(if you are going to use your nameservers for that domain).

Secondly, if you point a domain to some IP in your server and the domain doesn't exist, then the site will load the first virtualhost in that IP.

So, you can configure that location in apache as the first virtualhost (a dummy domain) and load the default page in it. Then add the DNS for the domain with the corresponding IP, so that the domain will load the default page served by the dummy domain.

However, rather than just adding DNS, I would recommend adding the domain itself (assuming you have script for it, if you are not using any control panel) with default page copied to the domain's document root as index so that the site will load the default page unless a new index page is uploaded.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.