feat: improve admin experience and ignore local data

This commit is contained in:
2026-04-14 19:12:20 +08:00
parent 6378ab4994
commit 2e3eb4b8f8
10 changed files with 1132 additions and 119 deletions
+33 -1
View File
@@ -111,4 +111,36 @@ sudo systemctl daemon-reload
sudo systemctl enable --now hy2-panel
```
如果你需要对外开放,再在 Nginx/Caddy 前面反代 `127.0.0.1:3000` 即可。
## Nginx 反代
已提供示例站点配置 [deploy/nginx-hy2-panel.conf](/root/hy2-panel/deploy/nginx-hy2-panel.conf)。
如果你的公网域名是 `hy2.xn--876a.net`,建议生产环境把 `.env` 中的 `APP_URL` 改成:
```bash
APP_URL=https://hy2.xn--876a.net
SESSION_COOKIE_SECURE=auto
```
示例配置默认反代到 `127.0.0.1:3000`,证书路径为:
```text
/etc/nginx/ssl/hy2.xn--876a.net/fullchain.pem
/etc/nginx/ssl/hy2.xn--876a.net/privkey.pem
```
典型启用流程:
```bash
sudo mkdir -p /etc/nginx/ssl/hy2.xn--876a.net
sudo cp fullchain.pem /etc/nginx/ssl/hy2.xn--876a.net/fullchain.pem
sudo cp privkey.pem /etc/nginx/ssl/hy2.xn--876a.net/privkey.pem
sudo cp deploy/nginx-hy2-panel.conf /etc/nginx/sites-available/hy2-panel.conf
sudo ln -sf /etc/nginx/sites-available/hy2-panel.conf /etc/nginx/sites-enabled/hy2-panel.conf
sudo nginx -t
sudo systemctl reload nginx
```
如果你当前的 hy2 节点仍然直接访问 `http://38.246.237.36:3000/api/hy2/...` 作为鉴权地址,可以继续保留这一入口。上面的 Nginx 只接管 `80/443` 上的域名访问,不会替换或中断现有的 `:3000` 直连。
面板内部生成链接时会优先使用反代传入的 `X-Forwarded-Host` / `X-Forwarded-Proto`,如果是直接访问 `http://38.246.237.36:3000`,则会自动退回到当前请求的 `Host`。