Updated on 2023-10-26 GMT+08:00

(Follow-up Operation) Updating a Static Website

If you need to update a static file (such as a picture, music file, HTML file, or CSS file) on a static website, you can upload this file again. By default, if you upload a new file using the same name as the file you previously uploaded to the same path of OBS, the new file overwrites the previous one. To avoid this problem, you can enable versioning for OBS. A versioned OBS bucket stores static files of multiple versions, so that you can quickly retrieve and restore different versions or restore data in the event of unintended operations or application failures.

Enabling Versioning

  1. Log in to OBS Console.
  2. In the bucket list, click the bucket you want to go to the Objects page. In the navigation pane, click Overview.
  3. In the Basic Configurations area, click Versioning. The Versioning dialog box is displayed, as shown in Figure 1.

    Figure 1 Configuring versioning

  4. Select Enable and click OK to enable versioning for objects in the bucket.

For more information about versioning, see Versioning.

Updating Static Files

  1. Log in to OBS Console.
  2. In the bucket list, click the bucket you want to go to the Objects page.
  3. Click Upload Object, or go to the folder where the file you want to update is located and click Upload Object. A dialog box is displayed, as shown in Figure 2.

    Figure 2 Uploading objects

  4. Add the file to be uploaded.

    • Static website files cannot be encrypted for upload.
    • It is recommended that you select Standard for the storage class. If you store the static website files in the Archive storage class, you need to restore the files before accessing them. For details, see Restoring an Archive File.

  5. Click Upload to complete the upload.

    The most recently uploaded file with the same name as those previously uploaded ones is displayed as the latest version in the object list. Each time, only the latest version is accessed. This way, the static website file can be updated.