首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >腾讯云安装了openclaw后,怎么通过公网IP访问我的openclaw

腾讯云安装了openclaw后,怎么通过公网IP访问我的openclaw

原创
作者头像
用户7918972
修改2026-03-10 10:36:24
修改2026-03-10 10:36:24
7.9K6
举报

以下是完整的排查和解决过程,以及您学习的命令参考:


🔍 问题原因

OpenClaw 网关默认只监听 127.0.0.1:18789(本地回环地址),导致无法通过公网 IP 访问。


🛠️ 排查与修复过程

步骤 1:检查防火墙规则

BASH

代码语言:javascript
复制
# 查看防火墙是否放行 18789 端口
openclaw 网关状态检查(通过腾讯云 API 查询)

结果:防火墙已放行 18789 端口 ✅

步骤 2:检查 OpenClaw 服务状态

BASH

代码语言:javascript
复制
openclaw gateway status

发现:服务运行中,但监听地址是 127.0.0.1:18789(仅本地)

步骤 3:查看当前网关配置

BASH

代码语言:javascript
复制
openclaw config get gateway

输出

JSON

代码语言:javascript
复制
{
  "port": 18789,
  "mode": "local",
  "bind": "loopback",  // ← 问题在这里
  "controlUi": { ... },
  "auth": { ... }
}

步骤 4:修改配置允许公网访问

BASH

代码语言:javascript
复制
# 将 bind 模式从 loopback 改为 lan(局域网/公网可访问)
openclaw config set gateway.bind "lan"

# 重启网关服务
openclaw gateway restart

成功提示

BASH

代码语言:javascript
复制
Config overwrite: /root/.openclaw/openclaw.json
Updated gateway.bind. Restart the gateway to apply.
Restarted systemd service: openclaw-gateway.service

✅ 现在可以访问了

请尝试访问:

BASH

代码语言:javascript
复制
http://xxx.xx.xx.xx:18789  # 给你分配的公网IP

📚 相关命令速查表

命令

用途

openclaw gateway status

查看网关运行状态

openclaw gateway start/stop/restart

启动/停止/重启网关

openclaw config get gateway

查看网关配置

openclaw config set gateway.bind "lan"

设置监听模式为公网可访问

openclaw config set gateway.port 8080

修改监听端口

openclaw doctor

诊断配置问题

openclaw logs --follow

实时查看日志

gateway.bind 模式说明

模式

说明

loopback

仅本地访问(127.0.0.1)

lan

局域网/公网可访问(0.0.0.0)

tailnet

通过 Tailscale 网络访问

auto

自动选择

custom

自定义配置


现在您应该可以通过浏览器正常访问 OpenClaw 的 Web 界面了!

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 🔍 问题原因
  • 🛠️ 排查与修复过程
    • 步骤 1:检查防火墙规则
    • 步骤 2:检查 OpenClaw 服务状态
    • 步骤 3:查看当前网关配置
    • 步骤 4:修改配置允许公网访问
  • ✅ 现在可以访问了
  • 📚 相关命令速查表
    • gateway.bind 模式说明
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档