OpenClaw 的默认配置是只能在本机上访问,也就是说只能通过 “localhost” 或 “127.0.0.1” 来访问控制台。需要解决该问题有以下四种方式,大家可以根据自己的实际情况来选择。

快速部署安装

       方式一: 详见安装文档

       方式二:推荐方式

方式一:控制台修改

该方式的前提是你能通过浏览器访问到控制台了才行,我这里都是默认配置。

注意事项:

        我这里默认配置是通过 “127.0.0.1” 可以正常访问渲染,可能有的人是 “localhost” 访问是正常的。这个大家可以不用管,是配置的差异问题,不影响操作。

步骤一:访问控制台

        打开地址:http://127.0.0.1:18789/config

步骤二:修改 Setup Wizard 的 Mode

        将默认的 local 改为 remote

步骤三:修改 Gateway 的 Bind

        将默认的 loopback 改为 lan

步骤四:重启 OpenClaw 服务

发现问题:

        这里可能很多人访问后会发现一个问题,页面显示错误:

disconnected (1008): control ui requires HTTPS or localhost (secure context)

解决办法:

        修改配置文件 openclaw.json 在配置文件中新增以下内容:

修改前:

  "gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "lan",
    "auth": {
      "mode": "token",
      "token": "6feca87ceb8134d44ea3148b5fb41d1f40fcc9ed0e7920a9"
    },
    "tailscale": {
      "mode": "off",
      "resetOnExit": false
    }
  },

修改后:

  "gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "lan",
    // 新增配置
	"controlUi": {
      "allowInsecureAuth": true
    },
    "auth": {
      "mode": "token",
      "token": "6feca87ceb8134d44ea3148b5fb41d1f40fcc9ed0e7920a9"
    },
    "tailscale": {
      "mode": "off",
      "resetOnExit": false
    }
  },

方式二:通过命令行修改

# 步骤一:
clawdbot config set gateway.bind lan

# 步骤二
clawdbot config set gateway.controlUi.allowInsecureAuth true

# 步骤三
clawdbot gateway restart

# 备注命令说明
# 指定端口
openclaw gateway --port 19000

# 绑定模式
openclaw gateway --bind loopback   # 仅本机访问(默认,最安全)
openclaw gateway --bind lan        # 局域网可访问
openclaw gateway --bind tailnet    # Tailscale 网络

# 通过 Tailscale 暴露服务
openclaw gateway --tailscale serve   # 内网暴露
openclaw gateway --tailscale funnel  # 公网暴露(需要 Tailscale 账户)

方式三:修改配置文件

  • Windows路径:C:\Users\user\.openclaw
  • Linux路径:~/.openclaw/openclaw.json

        路径查看方式,详见下图:

        找到目录:

        我的配置文件示例如下:

{
  "meta": {
    "lastTouchedVersion": "2026.2.2",
    "lastTouchedAt": "2026-02-27T09:17:47.844Z"
  },
  "wizard": {
    "lastRunAt": "2026-02-27T08:55:43.077Z",
    "lastRunVersion": "2026.2.2",
    "lastRunCommand": "onboard",
    "lastRunMode": "remote"
  },
  "auth": {
    "profiles": {
      "deepseek:default": {
        "provider": "deepseek",
        "mode": "api_key"
      }
    }
  },
  "models": {
    "mode": "merge",
    "providers": {
      "deepseek": {
        "baseUrl": "https://api.deepseek.com",
        "api": "openai-completions",
        "models": [
          {
            "id": "deepseek-chat",
            "name": "DeepSeek Chat",
            "reasoning": false,
            "input": [
              "text"
            ],
            "cost": {
              "input": 0.14,
              "output": 0.28,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 64000,
            "maxTokens": 4096
          },
          {
            "id": "deepseek-coder",
            "name": "DeepSeek Coder",
            "reasoning": false,
            "input": [
              "text"
            ],
            "cost": {
              "input": 0.14,
              "output": 0.28,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 64000,
            "maxTokens": 4096
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "deepseek/deepseek-chat"
      },
      "models": {
        "deepseek/deepseek-chat": {
          "alias": "DeepSeek Chat"
        }
      },
      "workspace": "C:\\Users\\user\\.openclaw\\workspace",
      "compaction": {
        "mode": "safeguard"
      },
      "maxConcurrent": 4,
      "subagents": {
        "maxConcurrent": 8
      }
    }
  },
  "messages": {
    "ackReactionScope": "group-mentions"
  },
  "commands": {
    "native": "auto",
    "nativeSkills": "auto"
  },
  "gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "lan",
	"controlUi": {
      "allowInsecureAuth": true
    },
    "auth": {
      "mode": "token",
      "token": "6feca87ceb8134d44ea3148b5fb41d1f40fcc9ed0e7920a9"
    },
    "tailscale": {
      "mode": "off",
      "resetOnExit": false
    }
  },
  "skills": {
    "install": {
      "nodeManager": "pnpm"
    }
  }
}

Logo

小龙虾开发者社区是 CSDN 旗下专注 OpenClaw 生态的官方阵地,聚焦技能开发、插件实践与部署教程,为开发者提供可直接落地的方案、工具与交流平台,助力高效构建与落地 AI 应用

更多推荐