简体   繁体   English

如何使用AWS Route 53设置子域

[英]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 . 我只是围绕整个DNS的事情,虽然它很容易理解,但是我在使用Route 53设置子域时遇到了麻烦。我为我的新域设置了A记录(为了参数的缘故,让我们称之为mydomain.com.它运作完美!我现在想要做的是建立一个子域名( api.mydomain.com. ),它应该指向mydomain.com/api

How can I achieve this using AWS? 我如何使用AWS实现这一目标?

Here's some more info on my architecture. 这是关于我的架构的更多信息。

Domain Name Registrar ➜ Route 53 ➜ Beanstalk ➜ ELB ➜ Linux EC2 Instance ➜ Apache2 域名注册器➜路由53➜Beanstalk➜ELB➜LinuxEC2实例➜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): 您可能想要设置CNAME(如Ryan建议的那样):

api.mydomain.com.  CNAME mydomain.com.

Then you would create a VirtualHost for "api.mydomain.com." 然后,您将为“api.mydomain.com”创建一个VirtualHost。 in Apache and use mod_rewrite to rewrite http://api.mydomain.com/foo to http://api.mydomain.com/api/foo . 在Apache中并使用mod_rewrite将http://api.mydomain.com/foo重写为http://api.mydomain.com/api/foo

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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