skip to Main Content

In deploying a new app to EB, I found that the .ebextensions files that concern httpd are not being deployed to /etc.

The files as such are the same as the ones from another app, like this one:

/.ebextensions/cors.config

 files:
/etc/httpd/conf.d/cors.conf:
    mode: "000644"
    owner: webapp
    group: webapp
    content: |
        SetEnvIf Origin "^https?://localhost:[0-9]+.*|https?://127.0.0.1[:[0-9]+]?|https://mywebsite.com" REQUEST_ORIGIN=$0
        Header always add Access-Control-Allow-Origin %{REQUEST_ORIGIN}e env=REQUEST_ORIGIN
        Header add Access-Control-Allow-Headers "content-type, authorization"
        Header add Access-Control-Allow-Methods "GET, OPTIONS, POST, PUT, PATCH, DELETE"
        Header add Access-Control-Max-Age "86400"

Otherwise are identical to the ones provided by AWS in this depository

Note that I do have a file that is correctly deployed to /etc/php.d, so it would seem that the .ebextensions deployment overall is working.

The issue seems to be related to Apache. When configuring the environment I did notice a new selection to be made between Apache and Nginx. I did select Apache.

I am a bit out of ideas at this stage.

2

Answers


  1. You need to create this directory structure in your application root .platform/httpd/conf.d/ and put your apache config files in it.

    Refer to this article for more info:
    https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html

    Login or Signup to reply.
  2. I lost two days trying to discover this!
    It happens because the official tutorial/docummentation still not mentioning that ‘Configurations files’ structure has changed in Amazon Linux 2. As we can see, the guide shows us a wrong path for ‘.ebextensions/httpd/conf.d/ssl.conf’ in https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/https-singleinstance-tomcat.html.

    The new servers are coming with Amazon Linux 2, and therefore ‘httpd’ folder should stay outside ‘.ebextensions’, in a new root hidden folder called ‘.platform’

    If The migration guide:
    https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.migration-al.html, and/or changes in Ambient related folder structure, was referenced in tutorial should avoid this doubt. I leave a feedback to AWS to included it.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search