子域和 DNS
我目前拥有自己的域名和专用服务器,并向我的客户提供不同的套餐。我想要做的是让他们注册我的网站并自动创建一个包,他们可以通过他们的用户名作为子域进行访问,例如
http://yourusername.mywebsite.com
我目前为各个子域设置了 DNS 条目,其中包含我网站的真实信息,例如
名称类型IP地址
@A 1.2.3.4
错误 A 1.2.3.4
支持A 1.2.3.4
但是,如果现在有新客户注册,我必须手动为他们创建一个条目,并在其中包含他们的用户名。
我确信我见过一些网站可以自动执行此操作,有没有人有任何想法,或者我应该使用的任何其他方法?
谢谢,
标记
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
由于您显然无法控制名称服务器,因此您的选择非常有限。一种可能性是使用通配符 DNS 记录:
其中星号将替换每个名称。不理想(不存在的域也会出现)。
Since you apparently do not control the name servers, your choices are quite limited. One possibility is to use a wildcard DNS record:
where the star will replace every name. Not ideal (inexisting domains will also appear).
详细信息取决于您使用的 DNS 服务器。
一种方法是使用一些代码来打开 DNS 区域文件并添加所需的记录。在使用 Bind 的 Linux 上,您需要向服务器发出信号以使其重新读取区域文件。
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.
借助 Simple DNS Plus,您可以通过附带的 HTTP API 轻松添加此类 DNS 记录。例如:
With Simple DNS Plus, you can easily add such a DNS record through the included HTTP API. For example:
由于您显然无法控制名称服务器,因此您的选择非常有限。尽管如此,每个认真的 DNS 托管商都会为您提供一个 API(例如,请参见 Slicehost 的 API)。因此,您可以使用这个API并编写一个小程序来更新DNS数据。
(脚注:当您甚至无法控制名称服务器时处理付费客户似乎......很糟糕)
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)