开发者

Subdomains and DNS

I currently have my own domain name and dedicated server and I offer different packages to my clients. What I want to be able to do is have them sign up with my website and create a package automatically that they can access via their username as a subdomain e.g.

http://yourusername.mywebsite.com

I currently have DNS entries set up for various subdomains with real information for my website e.g.

Name Type IP Address

@ A 1.2.3.4

bugs A 1.2.3.4

support A 1.2.3.4

However, if a new customer signs up at the moment I have to go and manually create an entry for them with their username in it.

I'm sure I've seen websites that manage to do this automatically, does anyone have any ideas how, or any other methods 开发者_开发问答that I should be using?

Thanks,

Mark


Since you apparently do not control the name servers, your choices are quite limited. One possibility is to use a wildcard DNS record:

*  A  192.0.2.1

where the star will replace every name. Not ideal (inexisting domains will also appear).


The details depend on which DNS server you're using.

One approach is to have some code that opens the DNS zone file and adds the desired records. On Linux with Bind, you will then need to signal the server to get it re-read the zone file.


With Simple DNS Plus, you can easily add such a DNS record through the included HTTP API. For example:

http://127.0.0.1:8053/updatehost?host=yourusername.mywebsite.com&data=1.2.3.4


Since you apparently do not control the name servers, your choices are quite limited. Nevertheless, every serious DNS hoster provide you with a API (see for instance Slicehost's API). So, you may use this API and write a small program to update the DNS data.

(Foot note: handling paying customers when you do not even control the name servers seem... bad)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜