Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

389
Vistas
Elastic Beanstalk: `.ebextensions` not getting executed

I'm deploying a PHP application to Beanstalk and all appears to be fine, however my .ebextensions configuration files don't seem to be running.

I have just a single configuration file that is supposed to create a file, and then reload nginx.
/my-project/.ebextensions/nginx.config:

files:
  "/etc/nginx/conf.d/elasticbeanstalk/extend-nginx.conf" :
    mode: "000755"
    owner: root
    group: root
    content: |
      add_header X-Frame-Options "SAMEORIGIN";
      add_header X-XSS-Protection "1; mode=block";
      add_header X-Content-Type-Options "nosniff";

      location / {
          try_files $uri $uri/ /index.php?$query_string;
      }

container_commands:
    reload_nginx:
        command: "sudo service nginx reload"

My architecture is currently:
1. CodePipeline hooked up to GitHub that deploys the app to CodeDeploy everytime master is updated.
2. CodeDeploy receives the deployment from CodePipeline.
3. CodeDeploy installs it to the Elastic Beanstalk instance.

All the above steps work fine. I just don't understand why the config file in .ebextensions is not creating the file as expected.

Note: I have confirmed that the .ebextensions folder is in the root of the revision .zip by manually downloading one of the revisions and checking.

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

For me I was confused why a file I was trying to create was not showing up when I was deploying. The deployment had an error, and the system would automatically delete the file due to the error instead of letting it persist while rolling back to it's previous state on failure. This gave me the false notion that the file was never created in the first place.

I was able to determine this from /var/log/nginx/error.log which gave the following:

2020/07/29 20:11:36 [emerg] 23006#0: "gzip" directive is duplicate in /var/proxy/staging/nginx/conf.d/elasticbeanstalk/gzip.conf:1

which meant at least for me, I needed to override nginx.conf instead of adding a configuration file. Make sure that you aren't getting errors with your deployment if you're not seeing a file get created.

over 4 years ago · Santiago Trujillo Denunciar

0

Try to simply put this file into .ebextensions/nginx/conf.d/elasticbeanstalk without a script.

At least this is how the Java SE platform works: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-se-nginx.html. I don't think this is different for PHP.

Also on your EC2 instace check the output of log files (cfn-init.log, cfn-init-cmd.log etc.).

over 4 years ago · Santiago Trujillo Denunciar

0

Can I refer you to the following link which describes the official way to configure the nginx reverse proxy on EB environments:

[1] Configuring the proxy server - https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/nodejs-platform-proxy.html

Another option is to use 'sed' like command to update the nginx configuration in place, as follows:

container_commands:
    enable_websockets:
        command: |
            sed -i '/\s*proxy_set_header\s*Connection/c \
                    proxy_set_header Upgrade $http_upgrade;\
                    proxy_set_header Connection "upgrade";\
            ' /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda