2026-04-20 · 6 min read
How to Deploy a Static Site to Cloudflare Pages (from Zero in 6 Minutes)
Cloudflare Pages is the fastest, cheapest way we know to put a static site on a real custom domain in 2026: free plan includes unlimited bandwidth, unlimited sites, and SSL certs that provision themselves. Every Morton Digital template deploys here in under a minute.
This is the literal walkthrough, timed. If you already have Node installed and a domain ready, it really is six minutes end-to-end.
1. Install the wrangler CLI (~30s)
npm install -g wrangler
Wrangler is Cloudflare's deploy CLI. It ships as a single npm package and works on macOS, Linux, and Windows. Confirm it installed:
npx wrangler --version
2. Authenticate (~1 min)
npx wrangler login
This opens a browser tab where you approve the CLI's access to your Cloudflare account. First time only — an auth token is stored in your home directory. If you don't have a Cloudflare account yet, sign up free at cloudflare.com — takes a minute.
3. Deploy your first version (~30s)
Unzip your template (or your own static site), cd into the directory, and run:
npx wrangler pages deploy . --project-name my-saas
On first run, wrangler creates the project. On subsequent runs, it ships a new version. You get output like:
✨ Success! Uploaded 14 files (1.43 sec) ✨ Deployment complete! https://my-saas.pages.dev https://abc12345.my-saas.pages.dev
Every deploy gets a permanent preview URL (the hash-prefixed one) so you can roll back instantly. The project-level URL (my-saas.pages.dev) always points at the latest deploy.
4. Verify in a real browser (~1 min)
Open the URL in an actual phone or desktop browser — not just a simulator or WebView. Click every link. Check the mobile nav toggle. Test the purchase flow if it has one. Two minutes of manual QA in a real browser catches the broken-link or broken-favicon issue that lint tools won't.
5. Attach your custom domain (~2 min + 2-10 min cert wait)
In the Cloudflare dashboard:
- Pages → your project → Custom domains
- Add
yourname.com(andwww.yourname.com— both) - If the domain is already on your Cloudflare account, DNS records are created automatically
- Otherwise, Cloudflare gives you a
CNAMEtarget to paste into your registrar's DNS panel
Cloudflare's Google-managed SSL cert typically provisions within 2-10 minutes. You can check https://yourname.com periodically — you'll get HTTP 522 while it's provisioning, then HTTP 200 the moment the cert is ready.
6. Re-deploying as you change things
Every future change is one command:
npx wrangler pages deploy .
Cloudflare hashes the files and only uploads changed ones, so incremental deploys take seconds. If you want a nicer workflow, connect the Pages project to GitHub — every git push to main auto-deploys. For most sites that's unnecessary ceremony.
Optional but recommended
Add a _headers file
Create a file called _headers at the root of your deploy directory. It configures per-route headers:
/* X-Frame-Options: DENY X-Content-Type-Options: nosniff Referrer-Policy: strict-origin-when-cross-origin Strict-Transport-Security: max-age=31536000; includeSubDomains /*.css Cache-Control: public, max-age=31536000, immutable /*.js Cache-Control: public, max-age=31536000, immutable
Security headers + far-future cache on hashed assets. Takes 30 seconds, measurably better Lighthouse + security scores.
Add a _redirects file if you rename pages
When you rename or move a page, add a line to preserve SEO:
/old-url /new-url 301
Enable a 301 from www to apex (or vice versa)
Pick a canonical — we use apex (morton-digital.com) — and redirect the other. Cloudflare's Bulk Redirect rules handle this in the dashboard, or you can add a _redirects line:
https://www.yourname.com/* https://yourname.com/:splat 301
Add Content-Security-Policy (later)
Skip on first deploy — easy to lock yourself out of third-party fonts or scripts. Come back to it once the site is stable. Start with default-src 'self' and loosen per-domain as needed.
Why Pages instead of Netlify or Vercel
All three are good. The reasons we default to Cloudflare Pages:
- Unlimited bandwidth on the free plan. Netlify caps at 100GB, Vercel at 100GB. For a content site that suddenly goes viral, this matters.
- No build-minute cap. If you deploy a pre-built folder (as you do with a single-file HTML template), there's nothing to build. Pages just uploads.
- Cloudflare's global edge network has measurably lower latency to most regions vs Netlify or Vercel.
- Cert provisioning is automatic with no per-domain fee at any scale. Some competitors charge per custom domain above a threshold.
- Easy path forward to Workers. When you later need dynamic server-side logic (a newsletter form, an API proxy), Cloudflare Pages Functions lives in the same project.
Total elapsed time
~6 minutes of active work, plus 2-10 minutes of waiting for the SSL cert to provision. You'll spend longer on lunch.
All Morton Digital templates ship with the deploy command in the README. Pick one, download, deploy, start iterating.
Need a template to deploy first? See Orbit, Horizon, or Forge.