Based on:
- https://cloud.google.com/storage/docs/website-configuration
- https://cloud.google.com/storage/docs/bucketnaming#verification
- https://cloud.google.com/storage/docs/gsutil/commands/rsync
- https://cloud.google.com/storage/docs/gsutil/commands/acl
- https://cloud.google.com/storage/docs/gsutil/commands/mb
Create new Durable Reduced Availability bucket, use hostname as the bucket name:
gsutil mb -c DRA gs://static.example.com
To use standard bucket, remove "-c DRA" above.
Change the ACL for all objects to be publicly accessible:
gsutil -m acl set -R -a public-read gs://static.example.com
Set default ACL for new objects:
gsutil defacl set public-read gs://static.example.com
Upload content to the bucket:
gsutil -m rsync -d -r ~/public_html gs://static.example.com
Turn off object versioning on the bucket:
gsutil versioning set off gs://static.example.com
Set index.html as the root directory index and 404.html as 404 error page:
gsutil web set -m index.html -e 404.html gs://static.example.com