简体   繁体   中英

How can I use AWS Route 53 to set up a subdomain

I'm very confused...

I'm just getting my head around the whole DNS thing and, while it's simple enough to understand, I'm having trouble setting up subdomains using Route 53. I've set up the A Record for my new domain (for argument's sake, let's call it mydomain.com. and it works perfectly! What I'd like to be able to do now is set up a subdomain ( api.mydomain.com. ), which should point to mydomain.com/api .

How can I achieve this using AWS?

Here's some more info on my architecture.

Domain Name Registrar ➜ Route 53 ➜ Beanstalk ➜ ELB ➜ Linux EC2 Instance ➜ Apache2

I don't care where I need to do it, so long as I can do it. Moreover, if there's a couple of ways to achieve it, then all the better! :)

Thanks in advance.

You would want to setup a CNAME (as Ryan suggested):

api.mydomain.com.  CNAME mydomain.com.

Then you would create a VirtualHost for "api.mydomain.com." in Apache and use mod_rewrite to rewrite http://api.mydomain.com/foo to http://api.mydomain.com/api/foo .

或者,应该可以创建一个S3存储桶api.mydomain,com并将其static website hosting设置为“将所有请求重定向到另一个主机名”,然后在那里输入mydomain.com/api

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM