I set out to host my Hugo site.
My goals were simple:
- Use sectrean.net as the canonical domain.
- Have www.sectrean.net redirect to sectrean.net.
- Support HTTPS for both domain names.
- Redirect HTTP connections to HTTPS.
- Default documents.
- Automated deployment when changes are pushed to the main branch.
I initially planned to use AWS. I set up S3 buckets for both domains and configured them for static website hosting. I set up Route 53, CloudFront, and created a managed SSL cert. I uploaded the static files manually and everything appeared to be working great. Until I clicked on About. It turns out that static website hosting with an S3 bucket only uses the default document (index.html) for the root and not subdirectories. I found that I could accomplish this use Lambda@Edge, but this was really starting to feel like a lot of things to manage for a simple site.
I briefly tried AWS Amplify. Unfortunately, it wasn’t able to build my Hugo site with the default build container. I needed Hugo extended. So I found a Docker image for Hugo extended and configured that in the Build image settings. Unfortunately, the build then started failing with no message at all.
So I next decided to try Azure Static Web App. I really liked the automatic integration with GitHub Actions. I soon found out that it doesn’t yet support apex domains (i.e., sectrean.net). I tried to work around this using Azure DNS and Front Door, but I was unable to get it to work.
Finally, I tried Netlify. I was able to get everything exactly how I wanted in a matter of minutes by simply checking some options.
I had also considered using GitHub Pages, or containerizing my site with Nginx as the web server. But I’m pretty happy with Netlify and it was incredibly simple to set up.