logo

How To Host Static Websites On GCP Cloud Storage

Last Updated: 2022-03-17

Follow the install page to install gsutil: https://cloud.google.com/storage/docs/gsutil_install

Follow the tutorial to setup: https://cloud.google.com/storage/docs/hosting-static-website

To sync the local public folder to the cloud:

$ gsutil -m rsync -d -r public gs://www.yourdomain.com

gsutil options:

  • -m: perform parallel (multi-threaded/multi-processing) synchronization.

rsync options:

  • -d: "Delete extra files under dst_url not found under src_url."
  • -r: recursive.