Search code examples
amazon-web-servicesnginxamazon-elastic-beanstalkebextensions

AWS Elastic Beanstalk .ebestensions/nginx/nginx.conf not overriding AWS' default nginx.conf


I have an AWS environment and I'm trying to override the nginx.conf that is used.

According to their documentation, this can be done by including your own file at .ebextensions/nginx/nginx.conf

To override Elastic Beanstalk's default nginx configuration completely, include a configuration in your source bundle at .ebextensions/nginx/nginx.conf

I've done that to no avail. I've tried creating an entirely new application environment to ensure it's not due to the instance not fully restarting, but the original nginx.conf is still being used. I have one other .ebextensions/ configuration file, and it is creating a file as expected.

Any clues as to why my nginx.conf isn't taking? Any details I could provide that might grant some insight? I searched for errors within eb-activity.log but did not see any. It did say that it inflated the .ebextensions/nginx/ directory and created the .ebextensions/nginx/nginx.conf file in the logs where it does so for the rest of the files / directories in your source bundle. Nowhere does it indicate that it tried to use my nginx.conf, though.


Solution

  • The documentation I was looking at was specifically for the java environment. The method works for several other environments, but the node environment startup process is different and ignores that file. I imagine it's because the server directive is within 00_elastic_beanstalk_proxy.conf, rather than nginx.conf.

    However, you can still override the nginx.conf by instead using an .ebextension config to create the file /etc/nginx/nginx.conf as I found from the reply in this AWS Forum post