Host a static website
In a public object store container, you can:
- static website for quick access to files and reduced storage costs;
- customize the error page. If the user requests a non-existent object, the request will be handled according to the settings: another object will be returned or a redirect to an external URL will take place.
Host a static website
Static sites consist of a set of files (HTML, JS, graphics, fonts) that can be stored as objects in a container. The site will be opened at of the container's public domain or user domain if it is added to the container.
There are two ways to host a website:
- hosting — you specify the main page of the website, which is stored as an object in a public container;
- web listing — Instead of displaying the main page, you enable the return of the list of objects in the container and set your CSS styles.
Set up hosting
- In the container load the object — HTML file, which will be the home page.
- in control panels from the top menu, press Products and select Object Storage.
- Go to the section Containers.
- Open the container page → tab Web site.
- In the block Web site turn on the toggle switch.
- Open the tab Hosting.
- Enter object path with a home page extension
.html
. - Click Save.
Customize web listing
-
If you want to store the CSS styles file in a container, download it.
-
in control panels from the top menu, press Products and select Object Storage.
-
Go to the section Containers.
-
Open the container page → tab Web site.
-
In the block Web site turn on the toggle switch.
-
Open the tab Web listing.
-
Enter the address of the CSS styles file. The format of the address depends on where the file is stored:
- in the container — enter object path with CSS styles;
- on a third-party resource — enter the URL of the file with CSS styles.
-
Click Save.
Customize the error page
If users access a non-existent object, an error will occur, which can be handled in two ways:
Return an object from a container
- in control panels from the top menu, press Products and select Object Storage.
- Go to the section Containers.
- Open the container page → tab Web site.
- In the block Error page turn on the toggle switch.
- Optional: If you want the object to return with code 200, select it as the response code. By default, the response to the request will be code 400.
- In the field Resource enter object path with an error page with the extension
.html
. - Click Save.
Perform request forwarding
- in control panels from the top menu, press Products and select Object Storage.
- Go to the section Containers.
- Open the container page → tab Web site.
- In the block Error page turn on the toggle switch.
- Select answer code 307.
- In the field Resource enter a valid external URL to which to redirect if the requested object does not exist.
- Click Save.