跳到內容

在 exe.dev 上快速部署 OpenClaw Gateway

每次想把本地跑得好好的服務搬到雲端,光是搞定防火牆、SSL 憑證和 Nginx 設定就足以讓人抓狂。你可能只是想快速弄個 Gateway 方便遠端存取,結果大半天的時間都耗在處理環境配置。

這篇文章會教你如何在 exe.dev 的 VM 上跑起 OpenClaw Gateway,讓你直接透過 https://<vm-name>.exe.xyz 就能從筆電連上它。

  • exe.dev 帳號
  • ssh exe.dev 存取 exe.dev 虛擬機的權限(選填)

如果你想省事,可以直接用 exe.dev 的 AI 助手 Shelley 幫你搞定。

  1. 打開 https://exe.new/openclaw
  2. 填入你的 auth key 或 token
  3. 點擊 VM 旁邊的 Agent 按鈕,然後稍等一下
  4. 部署完成,直接開始使用

Shelley 使用的指令如下(你也可以手動餵給它):

Set up OpenClaw (https://docs.openclaw.ai/install) on this VM. Use the non-interactive and accept-risk flags for openclaw onboarding. Add the supplied auth or token as needed. Configure nginx to forward from the default port 18789 to the root location on the default enabled site config, making sure to enable Websocket support. Pairing is done by "openclaw devices list" and "openclaw device approve <request id>". Make sure the dashboard shows that OpenClaw's health is OK. exe.dev handles forwarding from port 8000 to port 80/443 and HTTPS for us, so the final "reachable" should be <vm-name>.exe.xyz, without port specification.

如果你偏好自己動手,請參考以下流程。本指南預設你使用的是 exe.dev 的 exeuntu 鏡像。

在你的電腦執行:

Terminal window
ssh exe.dev new

接著連線進去:

Terminal window
ssh <vm-name>.exe.xyz

提示:請保持這個 VM 為 stateful。OpenClaw 會把狀態存在 ~/.openclaw/ 和 ~/.openclaw/workspace/。

在 VM 內執行:

Terminal window
sudo apt-get update
sudo apt-get install -y git curl jq ca-certificates openssl

執行 OpenClaw 的安裝腳本:

Terminal window
curl -fsSL https://openclaw.ai/install.sh | bash

編輯 /etc/nginx/sites-enabled/default 並貼入以下內容,將流量從 8000 端口轉發到 OpenClaw 預設的 18789 端口:

server {
listen 80 default_server;
listen [::]:80 default_server;
listen 8000;
listen [::]:8000;
server_name _;
location / {
proxy_pass http://127.0.0.1:18789;
proxy_http_version 1.1;
# WebSocket support
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Standard proxy headers
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Timeout settings for long-lived connections
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
}
}

現在你可以打開 https://<vm-name>.exe.xyz/。如果系統要求 auth,請在 VM 上執行以下指令獲取 token:

Terminal window
openclaw config get gateway.auth.token

或者生成一個新的:

Terminal window
openclaw doctor --generate-gateway-token

要核准裝置連線,請使用:

Terminal window
openclaw devices list
openclaw devices approve <requestId>
  • 找不到 Token:如果 gateway.auth.token 沒出現,試著執行 openclaw doctor --generate-gateway-token 重點生成。
  • 無法連線:確認 Nginx 設定檔已正確儲存並重啟服務。
  • 權限問題:如果裝置無法配對,請檢查 openclaw devices list 中的請求 ID 是否正確。
  • Shelley 失敗:如果自動化安裝卡住,隨時可以手動接手或在瀏覽器中重新呼叫 Shelley。

有任何安裝上的疑問?試試我們的 AI Setup Assistant。

OpenClaw

OpenClaw Expert

還是卡住了?

如果這篇文件沒有解決你的情境,直接問 OpenClaw Expert,拿到可執行步驟。