Skip to content
July-ietPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Jing's Room

一个用 Astro 构建的静态博客。文章保存在 src/content/posts/,用 Markdown 编写。

写文章

新增文章时,在 src/content/posts/ 新建 .md 文件。文件名会成为文章地址。开头按下面的格式填写信息:

---
title: 文章标题
summary: 一句话摘要
pubDate: 2026-10-12
tags:
  - 随笔
---

从这里开始写正文。

修改站名、作者和简介时,编辑 src/site.ts。

在服务器构建并访问

以下步骤以 Ubuntu / Debian 云服务器为例。服务器需要公网 IP 和 Node.js 22.12 或更高的偶数版本。用 SFTP 或 Git 将项目源码上传到服务器的 /home/你的用户名/jings-room/;不要上传 node_modules/。

SSH 登录服务器后,在项目目录中安装依赖并构建:

cd /home/你的用户名/jings-room
npm install

在项目根目录创建 .env 文件,先用 IP 访问时写入:

SITE_URL=http://你的公网IP

随后构建并复制生成的网页:

npm run build
sudo mkdir -p /var/www/jings-room
sudo cp -a dist/. /var/www/jings-room/

SITE_URL 必须是访客使用的公开地址,末尾不要加 /。RSS 会用它生成文章链接。若已有域名,将 .env 中的值改为 https://你的域名,并先把域名解析到服务器。

按照 Caddy 官方安装说明安装 Caddy,然后编辑 /etc/caddy/Caddyfile。先用公网 IP 访问时:

http://你的公网IP {
  root * /var/www/jings-room
  file_server
}

使用域名时,将第一行改为 你的域名 {。保存后运行 sudo caddy validate --config /etc/caddy/Caddyfile 和 sudo systemctl reload caddy。同时在云服务器安全组和系统防火墙开放 80 端口;域名使用 HTTPS 时还需开放 443 端口。然后在其他设备的浏览器中打开 http://你的公网IP 或 https://你的域名。

更新文章时,重新上传 Markdown 文件,在服务器运行 npm run build,再把新的 dist/ 内容发布到网站目录。

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages