Skip to content

Instantly share code, notes, and snippets.

@jakemmarsh
Last active September 13, 2021 11:06
Show Gist options
  • Save jakemmarsh/954cb1b3a1b06c2ef4d7f16d945cccf1 to your computer and use it in GitHub Desktop.
Save jakemmarsh/954cb1b3a1b06c2ef4d7f16d945cccf1 to your computer and use it in GitHub Desktop.
Modify nginx proxy settings in Elastic Beanstalk options
files:
"/tmp/proxy.conf":
mode: "000644"
owner: root
group: root
content: |
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
container_commands:
00-add-config:
command: cat /tmp/proxy.conf >> /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf
01-restart-nginx:
command: /sbin/service nginx restart
@NathanKun
Copy link

According to the doc https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html
Now we should place the nginx conf files in .platform/nginx

|-- web.jar
|-- .ebextensions/
|-- .platform/
    |-- nginx/                # Proxy configuration
    |   |-- nginx.conf
    |   `-- conf.d/
    |       `-- custom.conf

This is actually a lot easier because aws will copy nginx conf files and reload nginx process automaticlly so that we don't need to write any command.

Tested at Sept 2021.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment