Files
onion-dmp/fix-and-start.sh
2026-04-08 14:52:09 +08:00

56 lines
1.5 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
echo "🔧 正在修复 Cloudflare Tunnel 部署..."
echo ""
# 停止所有正在运行的服务
echo "1⃣ 停止旧进程..."
pkill -f "cloudflared tunnel" 2>/dev/null
pkill -f "node server.js" 2>/dev/null
sleep 2
# 检查本地服务器能否启动
echo "2⃣ 测试本地服务器..."
cd /Users/inkling/Desktop/dmp
node server.js &
SERVER_PID=$!
echo " ✅ 服务器已启动 (PID: $SERVER_PID)"
sleep 3
# 测试本地访问
echo "3⃣ 测试本地访问..."
if curl -s http://localhost:3456 | grep -q "洋葱"; then
echo " ✅ 本地服务正常"
else
echo " ❌ 本地服务异常"
exit 1
fi
# 检查并修复 DNS 配置
echo "4⃣ 检查 DNS 配置..."
echo " Tunnel ID: d8a6a4cd-4ddf-4122-92f1-b3d961aca422"
echo " 域名: dmp.ink1ing.tech"
echo ""
echo " 需要在 Cloudflare Dashboard 中确认 DNS 记录:"
echo " 类型: CNAME"
echo " 名称: dmp"
echo " 内容: d8a6a4cd-4ddf-4122-92f1-b3d961aca422.cfargotunnel.com"
echo " 代理: 已启用 (橙色云朵)"
echo ""
read -p " 按回车继续启动 Tunnel..." dummy
# 启动 Cloudflare Tunnel
echo "5⃣ 启动 Cloudflare Tunnel..."
echo ""
echo "================================================"
echo " 🌐 公网地址: https://dmp.ink1ing.tech"
echo " 💻 本地地址: http://localhost:3456"
echo " 🛑 停止服务: 按 Ctrl+C"
echo "================================================"
echo ""
cloudflared tunnel --config cloudflare-tunnel.yml run dmp-tunnel
# 清理
kill $SERVER_PID 2>/dev/null