IF
IndexFlowing
/ Docs
🌐 English Docs GitHub ↗

快速开始

本指南将帮助你启动 IndexFlow 实例、初始化管理员账户、连接网站并运行首条自动化索引流水线。


1. 前置条件

运行 IndexFlow 前,请确保机器或服务器已安装:

  • Rust 工具链(1.75.0 或更高版本):curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • SQLite3 构建库
  • Git

2. 克隆并构建

克隆 IndexFlow-core 仓库并构建发布二进制文件:

# Clone the core repository
git clone https://github.com/IndexFlowing/IndexFlow-core.git
cd IndexFlow-core

# Create your local environment file
cp .env.example .env 2>/dev/null || cat << 'EOF' > .env
SERVER_HOST=0.0.0.0
SERVER_PORT=8080
DATABASE_URL=sqlite:indexflow.db?mode=rwc
DB_MAX_CONNECTIONS=5
WORKER_POLL_INTERVAL_SECS=2
SUBMIT_WORKER_INTERVAL_SECS=5
SUBMIT_WORKER_BATCH=10
JWT_SECRET=change-this-to-a-secure-random-string-in-production
DRY_RUN=true
RUST_LOG=indexflow_core=info,tower_http=info
EOF

# Build and run the service
cargo run --release

启动成功后,控制台输出将显示:

INFO indexflow_core: config loaded host="0.0.0.0" port=8080 db="sqlite:indexflow.db?mode=rwc" dry_run=true
INFO indexflow_core: SQLite database connected with WAL mode (max_connections=5)
INFO indexflow_core: applying SQLite database migrations...
INFO indexflow_core: SQLite migrations applied elapsed_ms=12
INFO indexflow_core: IndexFlow Web Console is running at http://127.0.0.1:8080

3. 初始化管理员账户

在全新数据库上启动 IndexFlow 时,不存在管理员用户:

  1. 打开浏览器并访问 http://localhost:8080。
  2. 服务器检测到 admin_users 为空,并自动将你重定向到 /setup。
  3. 填写初始管理员用户名和密码:
    • 用户名:admin
    • 密码:<your-secure-password>
  4. 点击 Complete Setup & Launch。IndexFlow 使用 bcrypt 哈希密码,创建账户,签发由 JWT_SECRET 签名的 HTTP-only if_token cookie,然后将你重定向到 /settings。

4. 配置首个网站

在 Settings 视图(/settings)中配置站点信息:

  1. 网站域名:example.com(不要加 http:// 或 https:// 前缀)。
  2. Sitemap URL:https://example.com/sitemap.xml。
  3. Cloudflare WAF Token (可选):如果网站阻止自动扫描器,在此输入秘密 token,将其追加到爬虫 User-Agent。
  4. Bing IndexNow Key (可选):输入用于 Bing 推送的 32 位十六进制密钥。
  5. Bing Webmaster API Key (可选):输入来自 Bing Webmaster Tools 的 API 密钥。
  6. Google Service Account JSON (可选):粘贴用于 Google Search Console 和 Indexing API 访问的完整 JSON 密钥文件内容。
  7. 点击 Save Configuration。

5. 运行四阶段生命周期流水线

从顶部导航或侧边栏触发各流水线阶段来处理 URL:

步骤 1:同步 Sitemap(/sitemap)

点击 Sync Sitemap。后台 SyncWorker 递归下载并解析 XML sitemap 层级,使用 SHA-256 哈希去重 URL,计算调度优先级并写入数据库。

步骤 2:技术 SEO 质量门(/seo)

点击 Run SEO Audit。SeoAuditWorker 并发根据严格质量标准评估已发现的 URL(最多 30 个并发 worker,检查 HTTP 200 响应、canonical 标签匹配、没有 noindex 以及 robots 指令)。

步骤 3:检查官方索引雷达(/indexing)

  • 点击 Sync Google Impressions,从 Search Console Search Analytics 批量导入已确认的索引 URL,不消耗 URL Inspection 配额。
  • 点击 Start GSC Inspection 或 Start Bing Inspection,通过官方 API 验证剩余未确认页面。

步骤 4:主动引擎推送(/submit)

点击 Submit to All Engines。PushWorker 筛选通过 SEO 门且尚未索引的 URL,分批发送到 Bing IndexNow 和 Google Indexing API。


6. 通过 REST API 验证

可以使用健康检查端点验证实例状态:

curl http://localhost:8080/health

预期 JSON 响应:

{
  "db": "sqlite-wal",
  "service": "indexflow-core",
  "status": "healthy"
}

获取站点的实时索引指标:

curl "http://localhost:8080/api/v1/stats?site_id=1" \
  -H "Cookie: if_token=<YOUR_JWT_TOKEN>"