From 8a17d99fddbc1bfdbb0f8b118ab4eba6b48c53ed Mon Sep 17 00:00:00 2001 From: npmrun <1549469775@qq.com> Date: Wed, 6 May 2026 23:26:19 +0800 Subject: [PATCH] fix: update service port from 8080 to 8819 across configuration files --- Caddyfile | 4 ++-- README.md | 12 ++++++------ backend/main.go | 2 +- frontend/vite.config.js | 4 ++-- short-link.service | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Caddyfile b/Caddyfile index aed8792..1cce9ad 100644 --- a/Caddyfile +++ b/Caddyfile @@ -1,12 +1,12 @@ xieyaxin.top:8899 { @api path /api/* handle @api { - reverse_proxy localhost:8080 + reverse_proxy localhost:8819 } @shortcode path_regexp shortcode ^/[a-zA-Z0-9]{7}$ handle @shortcode { - reverse_proxy localhost:8080 + reverse_proxy localhost:8819 } handle { diff --git a/README.md b/README.md index cdfe4c8..fefa82f 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ ``` 用户请求 → Caddy - ├── /api/* → Go 后端 :8080 - ├── /[a-zA-Z0-9]{7} → Go 后端 :8080 (短码重定向) + ├── /api/* → Go 后端 :8819 + ├── /[a-zA-Z0-9]{7} → Go 后端 :8819 (短码重定向) └── 其他 → 静态文件 /opt/short-link/frontend ``` @@ -28,8 +28,8 @@ cd backend # 安装依赖 go mod tidy -# 运行 (默认 :8080) -ADDR=:8080 DOMAIN=http://localhost:8080 DB_PATH=./data.db ADMIN_TOKEN=dev go run . +# 运行 (默认 :8819) +ADDR=:8819 DOMAIN=http://localhost:8819 DB_PATH=./data.db ADMIN_TOKEN=dev go run . # 运行测试 go test ./... @@ -98,8 +98,8 @@ systemctl reload caddy | 环境变量 | 默认值 | 说明 | |----------|--------|------| -| `ADDR` | `:8080` | 监听地址 | -| `DOMAIN` | `http://localhost:8080` | 短链接域名,用于拼接 short_url | +| `ADDR` | `:8819` | 监听地址 | +| `DOMAIN` | `http://localhost:8819` | 短链接域名,用于拼接 short_url | | `DB_PATH` | `./data.db` | JSON 数据文件路径 | | `ADMIN_TOKEN` | (空) | 管理员 Bearer Token,空值时所有管理接口返回 401 | diff --git a/backend/main.go b/backend/main.go index 77de2be..d742cfb 100644 --- a/backend/main.go +++ b/backend/main.go @@ -13,7 +13,7 @@ import ( ) func main() { - port := flag.String("port", "8080", "listen port") + port := flag.String("port", "8819", "listen port") dbPath := flag.String("db", "shortlink.db", "sqlite database path") baseURL := flag.String("base-url", "", "base url for short links (e.g. https://xieyaxin.top:8899)") flag.Parse() diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 25c7df0..9c12ac8 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -5,8 +5,8 @@ export default defineConfig({ plugins: [svelte()], server: { proxy: { - '/api': 'http://localhost:8080', - '^/[a-zA-Z0-9]{7}$': 'http://localhost:8080' + '/api': 'http://localhost:8819', + '^/[a-zA-Z0-9]{7}$': 'http://localhost:8819' } } }); diff --git a/short-link.service b/short-link.service index 89e59db..e3fcf5a 100644 --- a/short-link.service +++ b/short-link.service @@ -7,7 +7,7 @@ Type=simple ExecStart=/opt/short-link/short-link-server Environment=DB_PATH=/opt/short-link/data Environment=DOMAIN=https://xieyaxin.top:8899 -Environment=ADDR=:8080 +Environment=ADDR=:8819 Environment=ADMIN_TOKEN=asdaersfdgfdhtretewfsddfgfdgdsfs Restart=always RestartSec=5