Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to setup an application within Amazon's Elastic Beanstalk, and I'd like to use a subdomain for part of the application. Ideally, that subdomain would be mapped to a folder within the document root (ie: http://test.mydomain.com pulls the sources from /var/www/html/test). I could setup another alias record in Route 53 for the subdomain, but how do I map Apache?

The only way I can think to accomplish this is to SSH in to a server directly, add the VirtualHost entry to my httpd.conf, then roll that server into an AMI and redeploy across EBS. Is that the only option? (it seems like there must be an easier way)

Thanks!

share|improve this question

2 Answers 2

up vote 0 down vote accepted

This is not possible with Elastic Beanstalk (at least not without really misusing it). Elastic Beanstalk is "fire and forget" type of PaaS solution aimed at simple deployments. If you really need this type of functionality, look into CloudFormation which lets you get much more granular with your instance configurations.

share|improve this answer

Try the following link.

Add a config file in your root inside .ebextensions directory.

Then add this.

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> 

More info here:

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.