在 / aws ebs 服务 index.html

Serve index.html at / aws ebs

我在 nginx 上使用反向代理服务静态文件。

我目前正在使用一个文件.ebextensions/static-files.config

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

这工作正常,但我必须导航到 /index 才能提供这些文件。是否可以选择在 / 为他们提供服务?我尝试同时使用“/”和空白键而不是索引,但均无效。

您可以为此使用 nginx 重定向功能。您可以轻松地将 / 重定向到 /index

NGINX 文档:https://www.nginx.com/blog/creating-nginx-rewrite-rules/

或者只使用 rewrite ^/$ /index.html last; ref: