export to public

This commit is contained in:
2026-04-09 09:46:00 +00:00
parent 8409655e66
commit 395c8e2e1c
2 changed files with 15 additions and 5 deletions

View File

@@ -232,6 +232,13 @@ tail -f logs/frontend.log
BACKEND_PORT=9000 FRONTEND_PORT=8451 ./start.sh
```
如果你希望脚本打印公网 IP 或域名,而不是机器的内网地址,可以额外指定:
```bash
PUBLIC_HOST=1ian.cn ./start.sh
PUBLIC_HOST=47.93.63.204 ./start.sh
```
## Docker 启动
如果你希望在 Ubuntu 24.04 或其他装有 Docker 的环境中快速运行,直接使用:

View File

@@ -132,15 +132,18 @@ fi
wait_for_port "127.0.0.1" "$FRONTEND_PORT" "frontend"
SERVER_IP="$(hostname -I 2>/dev/null | awk '{print $1}')"
if [[ -z "$SERVER_IP" ]]; then
SERVER_IP="127.0.0.1"
DISPLAY_HOST="${PUBLIC_HOST:-}"
if [[ -z "$DISPLAY_HOST" ]]; then
DISPLAY_HOST="$(hostname -I 2>/dev/null | awk '{print $1}')"
fi
if [[ -z "$DISPLAY_HOST" ]]; then
DISPLAY_HOST="127.0.0.1"
fi
cat <<EOF
VPlatform started in background.
Frontend: http://${SERVER_IP}:${FRONTEND_PORT}
Backend: http://${SERVER_IP}:${BACKEND_PORT}
Frontend: http://${DISPLAY_HOST}:${FRONTEND_PORT}
Backend: http://${DISPLAY_HOST}:${BACKEND_PORT}
Logs:
$BACKEND_LOG_FILE