Web Hosting
What is Web Hosting
So you have your website built. To make it available to online visitors, you need to put it online. Sure you can install a web server on your laptop, but you need to make sure it is always power-on, always connected to Internet, and can handle the potentially growing traffic; Or, find it a home in the cloud. That is the "Web Hosting" we are discussing here, a server (or a bunch of servers) hosting your content and always be ready to serve the visitors' requests.
Serve static website
This website is static, meaning the HTMLs and other resources are pre-generated by Gatsby, and there's no dynamic content, so there's no need to maintain the server and the database. Here are a few options to serve a static site:
- How to host static website on Amazon AWS EC2
- How to host static website on Amazon AWS S3
- Github Pages (https://pages.github.com/), you simply create a repository named
<username>.github.io
and push your code there, then your website can be access byhttp://<username>.github.io
- Netlify
Have more controls: Easy Options
If you think developing a website is hard and time-consuming, try deploying it and maintaining it by yourself. You need to manually config the servers, backup the content, scale up or scale out. Thankfully there are some awesome web services to help us get started. Often times they provide one-click (linux) distributions and apps, and scales automatically.
- BlueHost
- starts from $3.95/month
- Digital Ocean
- Starts from $5/month.
- Deploy some popular apps by one-click
- Heroku
Have more controls: use the full Cloud
If you desire more flexibilities, try out the 3 major public clouds:
All 3 offer some free tiers or quotas to help you get started.
- AWS: Free tier for 12 month
- Google: 60 days trial, up to $300
- Azure: 30 days trial, up to $200
Other things to consider
HTTPS
HTTPS is almost a must. Otherwise Chrome will render your website as "insecure".
If you are using AWS, HTTPS can be achieved by using CloudFront, however it may cost $600/month
Free https:
CDN
CDN stands for Content Delivery Network. It can distribute your content globally, so visitors can get the content from a server that is close to them.
- CloudFlare: highly recommended. The free tier provides CDN, HTTP/2, and HTTPS
- AWS CloudFront: if you are already using AWS