Nextline
操作指南

架在伺服器上(HTTPS)

讓手機或別台電腦也能用:Node 仍然只聽本機,由反向代理負責 HTTPS。

做法

Nextline 不直接對外提供 HTTP。HTTPS 交給同一台機器上的反向代理(下面用 Caddy 示範),Node 照樣綁 127.0.0.1,只讓代理連進來。

export NEXTLINE_DATA_DIR=/srv/nextline-data
export NEXTLINE_PUBLIC_URL=https://nextline.example.com
export NEXTLINE_TRUSTED_PROXIES=127.0.0.1
npm run selfhost:init
npm start

Caddy 設定範例

網域要先指到這台伺服器:

nextline.example.com {
  reverse_proxy 127.0.0.1:3000 {
    header_up Host nextline.example.com
    header_up X-Forwarded-Host nextline.example.com
    header_up X-Forwarded-Proto https
  }
}

repo 的 docs/deploy/ 有可直接用的 public.Caddyfile(公開網域)、local.Caddyfile(沒有網域時用 localhost:8443 和自簽憑證演練)與 supervisord.conf(程序掛掉自動重啟)。

代理要符合的規則

確認

curl --fail https://nextline.example.com/health

回 {"ok":true,"db":"ok"} 就好。接著把 agent 的 MCP 網址換成 https://nextline.example.com/mcp。

完整的 Caddy+Supervisor 演練步驟(含自簽 CA、停機備份、程序重啟)在 repo 的 docs/self-host.md。這份範例實測的是程序意外結束後自動重啟,沒有驗證整台主機重開或公開網域自動申請憑證。