在Amazon AWS Elastic Beanstalk中设置子域

我试图在亚马逊的Elastic Beanstalk中设置一个应用程序,我想为一部分应用程序使用一个子域名。 理想情况下,该子域将映射到文档根目录中的一个文件夹(即: http : //test.mydomain.com从/ var / www / html / test中获取源文件)。 我可以在路由53中为子域设置另一个别名logging,但是如何映射Apache呢?

我认为完成这个的唯一方法是直接SSH连接到服务器,将VirtualHost条目添加到我的httpd.conf中,然后将该服务器滚动到AMI中,并通过EBS重新部署。 这是唯一的select吗? (似乎必须有一个更简单的方法)

谢谢!

这对Elastic Beanstalk是不可能的(至less不是没有真正滥用它)。 Elastic Beanstalk是针对简单部署的“即热即忘”types的PaaS解决scheme。 如果您确实需要这种types的function,请查看CloudFormation ,它可以使您更好地了解您的实例configuration。

尝试以下链接。

在.ebextensions目录中的根目录中添加一个configuration文件。

然后添加这个。

files: "/etc/httpd/conf.d/vhost.conf": mode: "000644" owner: root group: root encoding: plain content: | NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot "/var/app/current/" <Directory "/var/app/current/"> Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted </Directory> </VirtualHost> <VirtualHost *:80> ServerName your-custom-domain-here.com DocumentRoot "/var/app/current/your-new-webroot" <Directory "/var/app/current/your-new-webroot"> Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted </Directory> </VirtualHost> 

更多信息:

http://blog.celingest.com/en/2013/04/05/elastic-beanstalk-cloudflare-newrelic-virtualhost-2/