Search code examples
amazon-web-servicesamazon-elastic-beanstalkreverse-proxy

Serve index.html at / aws ebs


I am serving static files using the reverse proxy on nginx.

I am currently using a file.ebextensions/static-files.config.

option_settings:
  aws:elasticbeanstalk:environment:proxy:staticfiles:
    /index: myapp/myapp/static

This works fine, but I must navigate to /index to have these files served. Is there an option to serve them at /? I tried using both "/" and a blank key instead of index and neither worked.


Solution

  • You can use nginx redirection feature for this. You can redirect / to /index easily

    NGINX documentation for this: https://www.nginx.com/blog/creating-nginx-rewrite-rules/

    or just use rewrite ^/$ /index.html last; ref: https://stackoverflow.com/a/8337492/970422