Configure a static website using S3 Bucket
Last updated
Was this helpful?
Last updated
Was this helpful?
มียอดคงเหลือใน project มากกว่า 0 บาท ()
ต้องมี bucket สร้างเอาไว้แล้ว ()
สร้าง bucket policy ให้มีสิทธิ์เข้าถึง ()
ทำการ put file ขึ้นบน s3 ในที่นี้จะใช้ root path
example command:
run command s3cmd ls เพื่อ check ว่า file ถูก upload แล้ว
example command:
example result:
เข้าไปที่ NIPA cloud portal - Object Storage - Buckets - Action - Enable
ทำการ Configure Index Document (Require) และ Error Document (Optional)
Index Document คือ path ของ index.html ในที่นี้จะใช้ที่ root path (index.html)
Error Document คือ path ของ error.html ในที่นี้จะใช้ที่ root path (error.html)
เมื่อดำเนินการ configure เรียบร้อยแล้ว ให้กด Confirm แล้วจะมีหน้าต่างขึ้นมา ให้ทำการ copy Website Endpoint
จากนั้นลองเข้า url ที่ copy มาจาก Website Endpoint
example result:
ถ้าหากไม่เป็นดังรูป ให้ทำการ put file ผ่าน s3cmd CLI ด้วย flag --acl-public
แล้วตรวจสอบอีกครั้ง
ให้ทำใส่ flag ดังนี้ที่ s3cmd CLI --guess-mime-type --no-mime-magic