Warning
This content has been generated by machine translation. The translations are automated and have not undergone human review or validation.
7.5 Static Website Hosting via Public Bucket
If we create a public bucket, we will use that it can be accessed by a URL path, and we will try to host a simple static website using dots. Object Storage is basically a date structure without a hierarchical structure. Let’s test how to handle web pages with folder structure
Constraints
Create Public Bucket
Create a public bucket by creating a bucket and changing the visibility to PUBLIC.
-
Create a Bucket.
- Name: Example) ExampleBucketForWeb
-
Click Edit Visibility to change the Visibility to Public.
Simple webpage test
-
Create a simple web page and save it as index.html file name.
<html> <header><title>Hello !!!</title></header> <body> <h1>Hello OCI Object Storage</h1> </body> </html>
-
Upload the index.html file to the Bucket.
-
Check the URL path on the detail page of the uploaded index.html.
-
If you access the verified URL path with a web browser, it works well.
Simple folder structure web page test
Object Storage is basically a date structure with no hierarchies. So when I look at the Object upload screen, there is no entry for the folder. However, in general, web pages have a folder structure. The folder structure is supported by adding a path to the object’s Name.
-
Edit the index.html file created earlier.
<html> <header><title>Hello !!!</title></header> <body> <h1>Hello OCI Object Storage</h1> <img src="images/icons8-oracle-96.png"/> </body> </html>
-
Upload the modified index.html file to the Bucket. If the Object Name is the same, the existing file will be overwritten.
-
Upload the image file. When uploading, change the Object Name to a name including the image path in html.
-
If you access the URL path of index.html identified above with a web browser, it works well.
-
Check the URL path of the image file object.
You can see that the URL path is set as it is by adding images/ in front of the Name.
-
If you access the URL path of the image file with a web browser, it works well.
When uploading many files, it is of course difficult to change the Name to a name including the path. If you use the CLI or a tool such as CloudBerry, the name of the object is automatically changed to the path form while uploading the local folder as it is, so there is no need to worry.
As an individual, this article was written with my personal time. There may be errors in the content of the article, and the opinions in the article are personal opinions.