skip to Main Content

I am migrating to Elastic Beanstalk and was not able to make changes to the nginx file, or even increment a new file. All configurations per AWS documentation did not work. So I did it as follows:

/.ebextesions -> 01_laravel_nginx.config:

files:
   "/opt/elasticbeanstalk/support/conf/laravel.conf":
     mode: "000644"
     owner: root
     group: root
     content: |
       location / {
         try_files $ uri $ uri / /index.php?$query_string;
         gzip_static on;
       }

/.ebextesions -> 02_install_nginx.config:

container_commands:
   01_runmyshellscript:
     command: "sudo ln -s /opt/elasticbeanstalk/support/conf/laravel.conf /var/proxy/staging/nginx/conf.d/elasticbeanstalk"

After performing this configuration, the same information as in the /var/proxy/staging/nginx/conf.d/elasticbeanstalk directory will be in the /etc/nginx/conf.d/elasticbeanstalk directory.

Is there any better way?

2

Answers


  1. Chosen as BEST ANSWER

    I was just trying to add one more conf, instead of changing what already existed by default. I tried to perform this configuration as follows:

    .platform / nginx / conf.d / laraval.conf
    

    But I didn't create. have to create all the files?

    .platform / nginx / conf.d / laraval.conf
    .platform / nginx / nginx.conf
    

  2. The proper way to setup nginx on EB environments using Amazon Linux 2 (AL2) is through .platform/nginx/conf.d/ as shown in the docs. Or if you want to fully overwrite the main nginx.conf you should provide its custom version using .platform/nginx/nginx.conf.

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