Total Pageviews

Sunday, 28 December 2025

在linux vps上,搭建基于nextjs的静态博客程序cnb

 登录linux vps上,首先安装nodejs,以及yarn (npm install -g yarn)

git clone  https://github.com/briteming/cnb

cd cnb

yarn

yarn build

 12799@vps# ~/cnb (main)
$ find . -name index.html
./.next/server/app/index.html
./node_modules/@tailwindcss/forms/index.html
./node_modules/katex/contrib/auto-render/index.html
./node_modules/katex/contrib/copy-tex/index.html
./node_modules/kbar/example/dist/index.html

12799@vps# ~/cnb (main)
$ cd .next/server/app/

12799@vps# ~/cnb/.next/server/app (main)
$ ls
_not-found/      blog.meta                          projects.rsc
_not-found.html  blog.rsc                           robots.txt/
_not-found.meta  index.html                         robots.txt.body
_not-found.rsc   index.meta                         robots.txt.meta
about/           index.rsc                          sitemap.xml/
about.html       page.js                            sitemap.xml.body
about.meta       page.js.nft.json                   sitemap.xml.meta
about.rsc        page_client-reference-manifest.js  tags/
api/             projects/                          tags.html
blog/            projects.html                      tags.meta
blog.html        projects.meta                      tags.rsc

12799@vps# ~/cnb/.next/server/app (main)

可见,~/cnb/.next/server/app就是静态网站的根目录。绑定你的域名到该目录,即可用你的域名访问此静态网站。

项目地址:https://github.com/calmzo/nextjs-blog

 https://github.com/calmzo/nextjs-blog/issues/1

https://github.com/briteming/cnb

演示博客:

我在vercel.com/new上,部署失败,但在linux vps上部署成功。

 

No comments:

Post a Comment