This can be done by a catch-all A record rule in your DNS server configuration. For example, in bind, you would use something like this:
*.example.com. IN A 127.0.0.1
This would make anything.example.com resolve to 127.0.0.1. Then, using an appopriate VHost on your http server, you can redirect all requests to a particular server-side script (for example PHP), which can then detect the hostname that was used, and respond with the content required.
There are restrictions on the characters that can be used (actually, two separate sets of restrictions due to the way IDNs work). There are practical limitations in terms of length. Beyond that no. Indeed, it's not much different for the entity in charge of .blogger.com to create a subdomain of that than for the entity in charge of .com to do so, and there were 80,000,000 of those at the start of last year .
发布评论
评论(2)
这可以通过 DNS 服务器配置中的包罗万象的 A 记录规则来完成。例如,在绑定中,您可以使用如下内容:
这将使 everything.example.com 解析为 127.0.0.1。然后,在 http 服务器上使用适当的 VHost,您可以将所有请求重定向到特定的服务器端脚本(例如 PHP),然后该脚本可以检测所使用的主机名,并以所需的内容进行响应。
This can be done by a catch-all A record rule in your DNS server configuration. For example, in bind, you would use something like this:
This would make anything.example.com resolve to 127.0.0.1. Then, using an appopriate VHost on your http server, you can redirect all requests to a particular server-side script (for example PHP), which can then detect the hostname that was used, and respond with the content required.
可以使用的字符有限制(实际上,由于 IDN 的工作方式,有两组独立的限制)。长度方面存在实际限制。除此之外没有。事实上,负责 .blogger.com 的实体创建该子域名与负责 .com 的实体创建子域名没有太大区别,去年年初,该子域名的数量为 80,000,000 个。
There are restrictions on the characters that can be used (actually, two separate sets of restrictions due to the way IDNs work). There are practical limitations in terms of length. Beyond that no. Indeed, it's not much different for the entity in charge of .blogger.com to create a subdomain of that than for the entity in charge of .com to do so, and there were 80,000,000 of those at the start of last year .