以下是完整的排查和解决过程,以及您学习的命令参考:
OpenClaw 网关默认只监听 127.0.0.1:18789(本地回环地址),导致无法通过公网 IP 访问。
BASH
# 查看防火墙是否放行 18789 端口
openclaw 网关状态检查(通过腾讯云 API 查询)结果:防火墙已放行 18789 端口 ✅
BASH
openclaw gateway status发现:服务运行中,但监听地址是 127.0.0.1:18789(仅本地)
BASH
openclaw config get gateway输出:
JSON
{
"port": 18789,
"mode": "local",
"bind": "loopback", // ← 问题在这里
"controlUi": { ... },
"auth": { ... }
}BASH
# 将 bind 模式从 loopback 改为 lan(局域网/公网可访问)
openclaw config set gateway.bind "lan"
# 重启网关服务
openclaw gateway restart成功提示:
BASH
Config overwrite: /root/.openclaw/openclaw.json
Updated gateway.bind. Restart the gateway to apply.
Restarted systemd service: openclaw-gateway.service请尝试访问:
BASH
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 | 实时查看日志 |
模式 | 说明 |
|---|---|
loopback | 仅本地访问(127.0.0.1) |
lan | 局域网/公网可访问(0.0.0.0) |
tailnet | 通过 Tailscale 网络访问 |
auto | 自动选择 |
custom | 自定义配置 |
现在您应该可以通过浏览器正常访问 OpenClaw 的 Web 界面了!
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。