在 Amazon EC2 中创建子域
如何在 Amazon EC2 上创建子域?
在 httpd.conf 中添加虚拟主机就足够了..还是还需要进行任何其他更改?
谢谢
How can I create subdomains on Amazon EC2?
Is adding virtual host in httpd.conf is enough.. or any other changes also needs to be done?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
取决于您的服务器软件。但正如您提到的 httpd.conf,您很可能在 Linux 发行版上运行 Apache。如果是这样的话,那么添加虚拟主机就足够了。这是一种方法:
为您的域创建一条 DNS 记录,例如指向您的弹性 IP/DNS 名称的 CNAME 记录:
<代码>subdomain.example.com => ec2-xx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com
确保您的 httpd.conf 包含允许虚拟主机的行:
NameVirtualHost *:80
创建虚拟主机指令:
httpd.conf:
6. 重新启动 Apache
Depends on your server software. But as you mention httpd.conf, chances are good that you run Apache on a Linux distribution. If that's the case then yes, adding a virtual host is enough. Here is one way of doing it:
Create a DNS record for your domain, for instance a CNAME record to point to your Elastic IP/DNS name:
subdomain.example.com => ec2-xx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com
Make sure your httpd.conf contains a line to allow virtual hosts:
NameVirtualHost *:80
Create a virtual host directive:
httpd.conf:
6. Restart Apache