Documentation on how to override or extend the default nginx config on Elastic Beanstalk running om Amazon Linux 2. Correct as of 2021-08-01. Also see the general documentation on how to extend linux servers.
All references to placing files refer to putting a file at this location in your application bundle. You should never modify a file directly at your Elastic Beanstalk server by ssh:ing to the server, since such a change will be wiped whenever your servers autoscale or if you rebuild your application completely.
The easiest extension is to add a new location block to the main server block. This can be done by placing a .conf
file with a server block in the folder .platform/nginx/conf.d/elasticbeanstalk
. Any such file is automatically included in the main server block.