Nameservers and DirectAdmin

DrWizzle

Verified User
Joined
Aug 8, 2021
Messages
20
Hi guys,

I've recently installed DA on my VPS and am embarking on a little project. I was wondering if any of you could help me with a couple of things?
I'm going to be creating a website selling domains. I've set server up and created nameservers ns1 & ns2.
My question is, i'll be hosting possibly hundreds of domains (I own about 200+ at mo), is there a script (preferably PHP) I can add into my site so that when I enter the domain name for entry into the local database, it also registers the domain in DA, (maybe as a pointer?) so the domain will resolve to a landing page.
Also, is there any way I can setup a page so that any domain that has the required nameservers, but not registered in DA resolves to an error page, or the home page of the site?

Sorry if i'm asking alot here!

And Happy Xmas to you all.
 
is there a script (preferably PHP) I can add into my site so that when I enter the domain name for entry into the local database, it also registers the domain in DA, (maybe as a pointer?) so the domain will resolve to a landing page.
Just check how much (or how little) you have to do, because when you create a domain in Directadmin (via script or directly doesn't matter), DA will create the domain, and a landing page for you.
You can adjust the landing page which is used in the /home/admin/domains/default directory or /home/resellername/default directory. You can customize files which are used in there and/or add your own image.
However, the domain must already resolve then.

If you need a landing page which is visible before the domain resolved through DNS, then my tip won't do.
 
Just check how much (or how little) you have to do, because when you create a domain in Directadmin (via script or directly doesn't matter), DA will create the domain, and a landing page for you.
You can adjust the landing page which is used in the /home/admin/domains/default directory or /home/resellername/default directory. You can customize files which are used in there and/or add your own image.
However, the domain must already resolve then.

If you need a landing page which is visible before the domain resolved through DNS, then my tip won't do.
Thank you Richard. I see exactly what you mean here, and I like the way whatever is in the default folder gets copied across for the new domain as a landing page. .

I also see how that wouldn't work and you wouldn't see that if the domain at the registrar level wasn't resolving due to unset/misconfigured NS records. I would however like to create something/use a preconfigured script whereby if the domain wasn't registered with DA, but the NS records were correctly set and pointed to my servers IP address, that using the name would open an error page to remind the user to register the domain on the site if that makes sense.

Thank you for your reply, it's been most helpful!
 
open an error page to remind the user to register the domain on the site if that makes sense.

Well, what I'm going to give you here is another "hack" that I used to take all the subdomains of the system to my main domain. But you can do this to show a default page even without adding any domains to the DA.

I always like to use NGINX (Only NGINX), so keep in mind that I'm going to assume you're using it. (If not, just change the DA settings)

As soon as you add NS to the domain, it will show a standard NGINX page: "Nginx is working properly" (or something like that XD)

Change the page in
Code:
var/www/html/index.html
and
Code:
chattr +i var/www/html/index.html
to lock the file from future changes.

You can see that my NS1 (ns1.ramon guilherme.da) redirects to my main domain.

That should work fine for what you're proposing.

Any questions just mention ;)
 
Back
Top