ref: FROM stack overflow
- 首先把網站上傳到 s3 bucket 上安置好, 並且設定可以外部瀏覽.
- 到 CloudFront distributions 設定如下的規定
- Default Root Object: index.html
- Origin Domain Name: S3 bucket domain, 例如: rel20251024.s3.amazonaws.com
- 另外也可以加上 error page 或是 404 的設定
- HTTP Error Code: 403: Forbidden or 404: Not Found, in case of S3 Static Website
- Customize Error Response: Yes
- Response Page Path: /index.html
- HTTP Response Code: 200: OK
- Click on Create
以上資料參考
https://stackoverflow.com/questions/16267339/s3-static-website-hosting-route-all-paths-to-index-html
另外如果有需要將你的靜態網站使用 https 連線的話可以參考這一篇
https://blog.johnwu.cc/article/aws-s3-cloudfront-ssl-%E9%9D%9C%E6%85%8B%E7%B6%B2%E9%A0%81%E6%9E%B6%E7%AB%99%E6%95%99%E5%AD%B8.html