update at 2026-02-10 17:03:44

This commit is contained in:
douboer
2026-02-10 17:03:44 +08:00
parent 58b2d15eae
commit 8fd471a8f9
3 changed files with 17 additions and 34 deletions

View File

@@ -8,17 +8,12 @@ server {
return 301 https://$host:8443$request_uri;
}
# Cloudflare Tunnel 入口(推荐):
# 外部 https://mac-tunnel.biboer.cn(443) -> cloudflared -> 本机 80直连本机服务
server {
listen 8443 ssl;
listen [::]:8443 ssl;
http2 on;
server_name mac.biboer.cn;
# SSL 证书
ssl_certificate /Users/gavin/mac.biboer.cn_ecc/fullchain.cer;
ssl_certificate_key /Users/gavin/mac.biboer.cn_ecc/mac.biboer.cn.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
listen 80;
listen [::]:80;
server_name mac-tunnel.biboer.cn;
# 静态资源根目录(包含 fonts/、fonts.json、miniprogram/assets/*
root /Users/gavin/font2svg;
@@ -45,9 +40,8 @@ server {
application/vnd.ms-fontobject eot;
}
# SVG 渲染 API独立 Python 服务,systemd 监听 127.0.0.1:9300
# SVG 渲染 API独立 Python 服务,监听 127.0.0.1:9300
location ^~ /api/ {
# 预检请求:直接返回 204CORS 头由 server 级 add_header 提供)
if ($request_method = OPTIONS) {
return 204;
}
@@ -62,7 +56,7 @@ server {
proxy_read_timeout 60s;
}
# 健康检查(可选)
# 健康检查
location = /healthz {
proxy_pass http://127.0.0.1:9300/healthz;
proxy_http_version 1.1;
@@ -72,35 +66,28 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
}
# fonts.json:短缓存,便于更新
# 配置文件:短缓存,便于切换
location = /fonts.json {
expires 1h;
add_header Cache-Control "public, must-revalidate" always;
add_header Access-Control-Allow-Origin "*" always;
add_header Access-Control-Allow-Methods "GET,HEAD,POST,OPTIONS" always;
add_header Access-Control-Allow-Headers "Origin,Range,Accept,Content-Type,Authorization" always;
add_header Access-Control-Expose-Headers "Content-Length,Content-Range" always;
try_files $uri =404;
}
# 小程序配置:短缓存,便于切换
location = /miniprogram/assets/fonts.json {
expires 1h;
add_header Cache-Control "public, must-revalidate" always;
add_header Access-Control-Allow-Origin "*" always;
add_header Access-Control-Allow-Methods "GET,HEAD,POST,OPTIONS" always;
add_header Access-Control-Allow-Headers "Origin,Range,Accept,Content-Type,Authorization" always;
add_header Access-Control-Expose-Headers "Content-Length,Content-Range" always;
try_files $uri =404;
}
location = /miniprogram/assets/default.json {
expires 1h;
add_header Cache-Control "public, must-revalidate" always;
add_header Access-Control-Allow-Origin "*" always;
add_header Access-Control-Allow-Methods "GET,HEAD,POST,OPTIONS" always;
add_header Access-Control-Allow-Headers "Origin,Range,Accept,Content-Type,Authorization" always;
add_header Access-Control-Expose-Headers "Content-Length,Content-Range" always;
try_files $uri =404;
}
location = /miniprogram/assets/route-config.json {
expires 30s;
add_header Cache-Control "public, must-revalidate" always;
try_files $uri =404;
}
@@ -108,10 +95,6 @@ server {
location ~* \.(ttf|otf|woff|woff2|eot)$ {
expires 30d;
add_header Cache-Control "public, immutable" always;
add_header Access-Control-Allow-Origin "*" always;
add_header Access-Control-Allow-Methods "GET,HEAD,POST,OPTIONS" always;
add_header Access-Control-Allow-Headers "Origin,Range,Accept,Content-Type,Authorization" always;
add_header Access-Control-Expose-Headers "Content-Length,Content-Range" always;
try_files $uri =404;
}

View File

@@ -62,7 +62,7 @@ miniprogram/
"cooldownMinutes": 10,
"servers": {
"A": { "baseUrl": "https://fonts.biboer.cn" },
"B": { "baseUrl": "https://mac.biboer.cn:8443" }
"B": { "baseUrl": "https://mac-tunnel.biboer.cn" }
}
}
```

View File

@@ -6,7 +6,7 @@
"baseUrl": "https://fonts.biboer.cn"
},
"B": {
"baseUrl": "https://mac.biboer.cn:8443"
"baseUrl": "https://mac-tunnel.biboer.cn"
}
}
}