ci: 部署到腾讯云服务器并启用 Gitea Actions 自动发布
- ci.yml 增加 deploy job:verify 全绿后 rsync 到 /opt/kanban/dist 并做线上自检 - runner 与站点同机(host 模式),部署直接写本地目录,不依赖 SSH 密钥与 Secrets - 站点目录是容器 bind mount,必须原地同步;manual deploy.sh 同步改为 rsync 语义 - 新增 deploy/:容器版 nginx 配置、runner 配置与 systemd 单元、服务器初始化脚本 - README 更新实际部署架构(1Panel + Nginx Proxy Manager 反代)与 runner 说明
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
# 看板 · 个人任务管理 —— Nginx 站点配置
|
||||
#
|
||||
# 用法(Ubuntu / Debian):
|
||||
# sudo cp deploy/nginx.conf /etc/nginx/conf.d/kanban.conf
|
||||
# sudo vim /etc/nginx/conf.d/kanban.conf # 改 server_name
|
||||
# sudo nginx -t && sudo systemctl reload nginx
|
||||
#
|
||||
# CentOS / RHEL 把文件放到 /etc/nginx/conf.d/kanban.conf 同样可用。
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name kanban.example.com; # ← 改成你的域名或服务器 IP
|
||||
|
||||
# deploy.sh 默认就发布到这个目录
|
||||
root /var/www/kanban;
|
||||
index index.html;
|
||||
|
||||
charset utf-8;
|
||||
|
||||
access_log /var/log/nginx/kanban.access.log;
|
||||
error_log /var/log/nginx/kanban.error.log;
|
||||
|
||||
# ---------- 缓存策略(PWA 能否正常更新,全看这三条) ----------
|
||||
|
||||
# 构建产物文件名带 hash,可以长期强缓存
|
||||
location /assets/ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# Service Worker 绝对不能缓存,否则发布后客户端永远停在旧版本
|
||||
location = /sw.js {
|
||||
expires off;
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
}
|
||||
|
||||
# index.html 引用着带 hash 的资源名,同样不能缓存
|
||||
location = /index.html {
|
||||
expires off;
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
}
|
||||
|
||||
location = /manifest.webmanifest {
|
||||
default_type application/manifest+json;
|
||||
expires off;
|
||||
add_header Cache-Control "no-cache";
|
||||
}
|
||||
|
||||
# ---------- 前端路由 ----------
|
||||
# /today 是真实路径,刷新时磁盘上没有对应文件,必须回落到 index.html。
|
||||
# 少了这条,直接访问或刷新 /today 会 404。
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# ---------- 传输压缩 ----------
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_min_length 1024;
|
||||
gzip_types
|
||||
text/plain
|
||||
text/css
|
||||
application/javascript
|
||||
application/json
|
||||
application/manifest+json
|
||||
image/svg+xml;
|
||||
|
||||
# ---------- 配好 HTTPS 之后 ----------
|
||||
# 1. 把上面的 listen 改成 443 ssl,并补上证书配置(或用 certbot 自动改)
|
||||
# 2. 取消下面这行注释,让 80 端口跳转到 443
|
||||
# return 301 https://$host$request_uri;
|
||||
}
|
||||
Reference in New Issue
Block a user