Edge cache should prefer small TTL (e.g., s-maxage=600) because deploys are cheap and static. If you add a CDN, keep Nginx as the origin with gzip/brotli and let the CDN handle TLS.
Portfolio / 技术博客
Calm dashboard of work, writing, and fragments.
Low-saturation layout that surfaces long-form posts, quick notes, and current projects. Built in Astro with content collections.
Posts
View allGitHub Actions → Nginx static deploy
Here is the minimal flow that keeps the origin server simple:
- Push changes or new Markdown.
- GitHub Actions runs
npm ci && npm run build. - Upload
dist/to/var/www/portfolioon the domestic server viarsyncorscp. - Nginx serves the static directory—no Node runtime, no database.
Why Astro is perfect for a fast portfolio
Astro ships zero-JS by default, which keeps first paint tiny even on slow networks. With content living in the repo, I can author Markdown or MDX locally, preview instantly via npm run dev, then publish via GitHub Actions without touching the server.
The build output is just HTML / CSS / JS under dist/, so the domestic server only needs Nginx + rsync to serve the files.
Key guardrails I use:
- Keep layout/components in
src/and content insrc/content/.
Notes (2)
View allI draft in Markdown locally, run npm run dev for previews, then push directly from the laptop. Small notes can be added in the GitHub UI on mobile—CI handles the build the same way.