Deployment
Deploying a Go Static Site to Vercel, Netlify, or Cloudflare
Deploying a Go Static Site to Vercel, Netlify, or Cloudflare
Once your Go static site builds successfully, deployment is simple: you upload a folder of static files. Every major host supports this. The differences are in the build command and output directory settings.
This guide covers deploying a Go static site generator's output — including GAX — to Vercel, Netlify, Cloudflare Pages, GitHub Pages, cPanel, and a VPS.
The Build Command
For a Go SSG like GAX, the build command is:
go build -o gax ./cmd/gax && ./gax build
This compiles the Go binary and runs the build. The output goes to the site/ folder.
If you already have a compiled binary on the server or CI image, you can run:
./gax build
Deploying to Vercel
1. Push your site to GitHub.
2. Import the repository in Vercel.
3. Set Build Command: go build -o gax ./cmd/gax && ./gax build
4. Set Output Directory: site
5. Deploy.
Vercel installs Go automatically if your repository includes a go.mod file. No additional setup is needed.
Deploying to Netlify
1. Push your site to GitHub.
2. Create a new site in Netlify from your repository.
3. Set Build Command: go build -o gax ./cmd/gax && ./gax build
4. Set Publish Directory: site
5. Deploy.
Netlify supports Go builds out of the box. You can set a specific Go version with a GO_VERSION environment variable.
Deploying to Cloudflare Pages
1. Push your site to GitHub.
2. Create a new Pages project in Cloudflare.
3. Set Build Command: go build -o gax ./cmd/gax && ./gax build
4. Set Build Output Directory: site
5. Deploy.
Cloudflare Pages supports Go builds. If your build needs a specific Go version, set GO_VERSION in the environment variables.
Deploying to GitHub Pages
1. Push your site to GitHub.
2. Add a workflow file to .github/workflows/deploy.yml.
3. Configure the workflow to build with Go and upload the site/ folder.
4. Enable GitHub Pages in repository settings.
GAX includes example workflows in .github/workflows/. Rename deploy.yml.example to deploy.yml to enable automatic deployment on push.
Deploying to a VPS or cPanel
Build locally or on the server:
./gax build
Then upload the site/ folder to your host:
- VPS — copy the folder via
rsyncor SFTP and point your web server to it - cPanel — upload the folder contents to
public_html
No PHP, no database, and no server-side runtime are needed. Just static files.
Common Issues
Build fails with "go: command not found" — the build environment does not have Go installed. Check the host's build image or install Go in the CI step.
Output directory is empty — verify the build wrote to site/, not public/ or dist/. Check your _data/config.yaml for the output path setting.
Sitemap is missing — check that the build ran without errors. If the build partially failed, sitemap generation may have been skipped.
CSS or images 404 after deploy — check that asset paths in your theme are absolute (/css/style.css) and that the public/ folder was copied to the output.
Summary
Static hosting is one of the simplest deployment paths available. Pick a host, set the build command and output directory, push to Git. That is the whole process.
FAQ
Can I deploy a GAX site to Vercel?
Yes. Set the build command to go build -o gax ./cmd/gax && ./gax build and the output directory to site.
Does Netlify support Go static site generators?
Yes. Netlify supports Go builds natively. Set the publish directory to site.
Can I deploy to Cloudflare Pages?
Yes. Cloudflare Pages supports Go builds. Set the build output directory to site.
Do I need a server to host a static site?
No. Static sites can be hosted on any static host or object storage. A VPS works too, but it is not required.
How do I deploy to cPanel?
Build the site, then upload the contents of the site/ folder to public_html through the cPanel File Manager or FTP.
Next Steps
Latest Guides
Jekyll Premium Theme: SEO-Ready Static Site for Content Sites
Premium Jekyll themes for blogs, docs, and content sites. SEO defaults, semantic HTML, GitHub Pages compatible, one-time purchase. From HockeyComputindo catalog.
Jekyll Premium Theme: SEO-Ready Static Site for Content Sites →
Eleventy Premium Theme: Fast Static Sites Without Node Bloat
Premium Eleventy themes for blogs, docs, and content sites. 11ty output, SEO defaults, semantic HTML, one-time purchase. From HockeyComputindo catalog.
Eleventy Premium Theme: Fast Static Sites Without Node Bloat →