本文详解 OpenClaw 局域网访问 Web 界面的配置,在局域网内通过 OpenClaw「宿主机 IP + 端口」即可直接访问 Web 界面,用密码登录管理。
前置要求
已安装 OpenClaw 并完成基础配置。
配置步骤
step 1:修改网关配置
进入配置向导:
openclaw configure按以下顺序进行配置:
│◇ Where will the Gateway run?│ Local (this machine)│◇ Select sections to configure│ Gateway│◇ Gateway port│ 18789│◇ Gateway bind mode│ LAN (All interfaces)│◇ Gateway auth│ Password│◇ Tailscale exposure│ Off│◇ Gateway password│ 123456│◇ Select sections to configure│ Continue│
正式环境请使用强密码,不要使用文中示例的简单密码!
step 2:放开访问权限
编辑配置文件:
sudo nano ~/.openclaw/openclaw.json在文件中加入以下配置:
"dangerouslyAllowHostHeaderOriginFallback":true,"dangerouslyDisableDeviceAuth":true
加入位置如下:
"controlUi":{"dangerouslyAllowHostHeaderOriginFallback":true,"dangerouslyDisableDeviceAuth":true}
保存文件后,网关会自动重启。
验证配置:重启完成后,在局域网内的任意设备浏览器中访问:
http://[宿主机IP]:18789输入设置的密码即可登录 Web 管理界面。
网关常用命令
# 安装服务openclaw gateway install# 启动/停止/重启/卸载服务openclaw gateway startopenclaw gateway stopopenclaw gateway restartopenclaw gateway uninstall# 状态监控openclaw gateway status
常见问题
Q: 访问显示连接失败?检查网关是否正常运行:
openclaw gateway statusQ: 端口可以修改吗?可以在配置向导中修改 Gateway port 即可,记得防火墙放行新端口。
夜雨聆风