- vite.config.ts: 加 base: '/app/',App 部署在子路径 - server/index.ts: MODELS_FILE 支持环境变量覆盖(容器化写权限) - homepage/index.html: 极简开发者风格个人主页(About/Projects/Skills/Contact) - nginx/default.conf: 反向代理,SSE proxy_buffering off,SPA fallback - docker-compose.yml: Nginx + Hono 容器编排,models_data volume 持久化 - deploy.sh: 一键本地构建 + rsync 上传 + 远端重启 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
56 lines
1.7 KiB
Plaintext
56 lines
1.7 KiB
Plaintext
server {
|
||
listen 80;
|
||
server_name www.mikivl.online mikivl.online;
|
||
return 301 https://$host$request_uri;
|
||
}
|
||
|
||
server {
|
||
listen 443 ssl http2;
|
||
server_name www.mikivl.online mikivl.online;
|
||
|
||
ssl_certificate /etc/letsencrypt/live/www.mikivl.online/fullchain.pem;
|
||
ssl_certificate_key /etc/letsencrypt/live/www.mikivl.online/privkey.pem;
|
||
ssl_protocols TLSv1.2 TLSv1.3;
|
||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||
ssl_session_cache shared:SSL:10m;
|
||
|
||
add_header X-Frame-Options SAMEORIGIN;
|
||
add_header X-Content-Type-Options nosniff;
|
||
add_header Referrer-Policy strict-origin-when-cross-origin;
|
||
|
||
# ── 后端 API(反向代理到 Hono,/api/ 优先匹配)──
|
||
location /api/ {
|
||
proxy_pass http://hono-server:3001;
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
# SSE 流式响应必须关闭缓冲
|
||
proxy_buffering off;
|
||
proxy_cache off;
|
||
proxy_read_timeout 300s;
|
||
chunked_transfer_encoding on;
|
||
}
|
||
|
||
# ── 读书笔记 App(/app/ 子路径,SPA)──
|
||
location /app/ {
|
||
alias /usr/share/nginx/html/app/;
|
||
index index.html;
|
||
try_files $uri $uri/ /app/index.html;
|
||
}
|
||
|
||
# ── 个人主页(根路径)──
|
||
location / {
|
||
root /usr/share/nginx/html/homepage;
|
||
index index.html;
|
||
try_files $uri $uri/ /index.html;
|
||
}
|
||
|
||
# 静态资源长缓存
|
||
location ~* \.(js|css|svg|ico|woff2?|png|jpg|webp)$ {
|
||
expires 1y;
|
||
add_header Cache-Control "public, immutable";
|
||
}
|
||
}
|