Skip to content

Instantly share code, notes, and snippets.

@p10rahulm
Last active March 6, 2024 02:09
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save p10rahulm/5d23f58ceca389a99594dde52849b381 to your computer and use it in GitHub Desktop.
Save p10rahulm/5d23f58ceca389a99594dde52849b381 to your computer and use it in GitHub Desktop.
Create Static Site using Godaddy and Google Cloud Storage in 15 minutes

Steps to create a static Site using Godaddy and Google Cloud Storage

Create a static html site

  • Can use this boilerplate to modify: http://www.initializr.com/
  • Make all your subpages and make sure to link them
  • Check your index.html works

Buy yourself a domain

  • Go to http://www.godaddy.com
  • Login to your account or create one
  • Search for a domain and pay for it
  • On godaddy click on your name on the topright
  • Click on manage domains
  • Click on the website domain you want to change
  • Go to the second tab, which is the DNS Zone file
  • Hold other steps till you setup the google cloud storage

Get yourself google analytics

  • go to https://analytics.google.com
  • in the Admin tab, click on add a property
  • add property corresponding to your site: www.your-domain-name.com
  • take the website tracking script and make sure to update all your static html pages with this tracking script
  • It should look something like this:
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-12346789-1', 'auto');
  ga('send', 'pageview');

</script>

Get yourself a google storage bucket

Verify domain name belongs to you

  • At this point, you will have to verify that you-domain-name.com belongs to you.
  • Go to the following site
  • https://www.google.com/webmasters/verification/home?hl=en
  • Click on add a property
  • type out the url and click continue
  • You should be able to do this simply enough if you are on godaddy
  • For other DNS hosts, you will be asked to upload some files to your domain.
  • Once verified continue with the next steps

Continue to google storage bucket

  • Upload all your files to the bucket
  • Make sure all folders etc are uploaded also
  • Go back to the main page. On the right side of the bucket you created click on options
  • Edit website config
  • Add index.html and 404.html
  • Go inside bucket. Click on select all files.
  • Click Share Publicly on the top list of options
  • Do this for all folders inside

Back to godaddy.com

  • Go into DNS Zone File for your domain
  • Click add record
  • Create a CNAME record pointing to c.storage.googleapis.com
  • Go to the setting page
  • Add a forwarding rule
  • Choose a 301 forwarding without masks to www.your-domain-name.com
  • You are done
  • Add forwarding rules form different domains you have bought into the main DNS host ex: my-other-domainname.com forwarding to www.your-domain-name.com.

Check Now Should be all done!


@gananggww
Copy link

can you give me a pic or video? im stuck!

@VJVemuri
Copy link

VJVemuri commented Jul 2, 2018

Wonderful Article. You made my life easier. Blindly followed and it worked.

Nice work.

@saanc
Copy link

saanc commented Oct 6, 2018

Awesome post.

@adelinor
Copy link

I just setup a static site hosted in the Google Cloud Platform for a domain hosted in GoDaddy.
Steps followed are like the above Gist except for the last section titled Back to godaddy.com:

  • Proceeding as suggested lead to the site forwarding to itself
  • After removing the forward rule in GoDaddy accessing www.your-domain.com was not showing my static site

After contacting both supports (GoDaddy and GCP support) here are the steps followed:

  • Go to the GCP console, under Network Services / Cloud DNS, create a zone called your-domain
  • With the GCP console, add a record set for

DNS Name: www.your-domain.com
Type: CNAME
Data: c.storage.googleapis.com

Changes to Name server settings take about 48 hours to propagate and this is why the debugging was lengthy.

@EmiXikes
Copy link

Can you do an 2022 update?

@kiriloman
Copy link

@aman2k4
Copy link

aman2k4 commented Oct 23, 2023

and also its explained very well in this video

https://www.youtube.com/watch?v=_g0yxRdMpTk&t=1339s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment