如何为AWS Cloud中的每个用户创建子域 [英] How to Create sub domain for every user in AWS Cloud
问题描述
有人可以指导我如何为AWS云中的每个用户创建一个子域吗?
Can Any one guide me how to create a subdomain for every user in AWS cloud?
开发堆栈,我正在使用的是PHP& mysql
Development Stack, I am using is PHP & Mysql
推荐答案
在Route 53中,您可以创建通配符子域.
In Route 53, you can create a wildcard subdomain.
如果在Route 53中有一个example.com域和一个example.com托管区域,则只需在其中创建一个新的A记录,其主机名为*
.然后,在托管区域中没有条目的任何 .example.com将返回该A
记录的值.或者,您可以创建一个子子网域,例如*.userpages.example.com
,以便任何内容 .userpages.example.com都能正常工作.为此,您将创建一个名为*.userpages
的A记录.子域无需额外的托管区域.
If you have a domain example.com, and an example.com hosted zone in Route 53, you simply create a new A record there with the hostname *
. Then, anything.example.com that doesn't already have an entry in the hosted zone will return the value of that A
record. Or you can create a sub-sub domain, like *.userpages.example.com
so that anything.userpages.example.com would work. For this, you'd create an A record called *.userpages
. There's no need for an additional hosted zone for the subdomain.
如果该A记录指向您的应用程序服务器,则仅保留给您的应用程序服务器检查传入的HTTP Host:
标头并呈现正确的内容.
If that A record is pointing to your application server, then it only remains for your application server to examine the incoming HTTP Host:
header and render the correct content.
或者,您可以使用Route 53 API几乎实时地动态创建域名,但是使用*
通配符方式可能会提供更好的用户体验,因为在传播DNS更改时不会有延迟
Alternatively, you could use the Route 53 API to dynamically create the domain names in near real time, but using the *
wildcard appoach will likely give a better user experience, because there will be no delay in propagating the DNS change.
这篇关于如何为AWS Cloud中的每个用户创建子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!