4

I've been moving over to ElasticBeanstalk using Amazon Linux 2 and I'm having a problem overwriting the default nginx.conf file. I'm following the AL2 docs for the reverse proxy.

They say, "To override the Elastic Beanstalk default nginx configuration completely, include a configuration in your source bundle at .platform/nginx/nginx.conf:"

My apps folder structure

enter image description here

When I run my deploy though, I get the error

CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment: Elastic Beanstalk ignored your '.ebextensions/nginx' configuration directory. To include these configuration files, move them to '.platform/nginx'.","timestamp":1598554657,"severity":"WARN"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1598554682,"severity":"ERROR"}]}]}

The main part of the error is

"Elastic Beanstalk ignored your '.ebextensions/nginx' configuration directory. To include these configuration files, move them to '.platform/nginx'.""

Which I'm confused about because this is where I've put the file/folder.

I've tried completely removing the .ebextensions folder and got the same error.

I've tried starting from a completely fresh beanstalk environment and still got that error. I'm not understanding how beanstalk is managing this.

MillerC
  • 663
  • 1
  • 11
  • 26
  • Are you sure you are deploying the app version you think you are? Maybe you need to commit your changes first to your repo, or using wrong zip files? – Marcin Aug 27 '20 at 22:13
  • I doubled checked and am trying the deploy again now. I downloaded the file I zipped to the applications folder and it's correct with the same structure from the picture. – MillerC Aug 27 '20 at 22:29
  • 1
    funny enough I was able to copy/paste the same .platform/nginx directory to another project and had it deploy as I'd expect. I did get a duplicate conf error from nginx so I have to check if I was getting that before but seems like my command calls are out of order or not getting used – MillerC Aug 28 '20 at 01:17
  • 1
    I don't know what's happening. Its like your `.extensions` still contain wrong folders in the old project. – Marcin Aug 28 '20 at 01:19
  • seems like it's probably an error with nginx -t - I have a .ebextension running a command to delete the default beanstalk conf file and it looks like that isn't being deleted – MillerC Aug 28 '20 at 01:20
  • 1
    Well... I got it to work... It seems like the duplicate nginx location was the main error. I'm still seeing a warning saying .ebextensions/nginx... move it to .platform for some reason. I can confirm that it's actually copying my updates nginx.conf from my .platform by adding a comment, deploying, ssh "cat /var/nginx/nginx.conf". So it's working, still throwing the error as a "Warning". – MillerC Aug 28 '20 at 02:28
  • Glad to hear. But do you know why there were duplicate nginx locations? – Marcin Aug 28 '20 at 02:29
  • 1
    I do, Elastic Beanstalk sets a default /var/nginx/conf.d/elasticbeanstalk/00.app-file.conf that has a single location block. I'm using this as an api so nothing should come in through that path. I was having trouble getting an ebextension config to delete the default file from a command so it would be deleted before the nginx conf got copied. I'll need to figure that out there. For now I'm happy it's at least working. Thank you for the help and responses. I saw you answered on a similar post about an issue where someone was using container_commands when he needed commands lol – MillerC Aug 28 '20 at 02:51
  • No problem. If you don't mind, I could provide an answer for future reference? Alternatively, you can answer your own question as well. – Marcin Aug 28 '20 at 02:52

1 Answers1

3

Based on the comments.

The issue was caused by duplicate locations of the nginx config file. This was due to deleting the nginx default path in .ebextensions, while EB re-creating it.

Since this seems as a bug, AWS support ticked was created.

Marcin
  • 215,873
  • 14
  • 235
  • 294