Set up a remote-controlled Chrome browser on a Linux VPS with noVNC visual access (via SSH tunnel) and optional authenticated HTTP proxy. Use when the user wants to run a browser on a VPS, control it remotely, view it via noVNC, or route browser traffic through a proxy.
在Linux VPS上设置Chrome,以便:
bash
apt-get install -y xvfb x11vnc novnc
bash
bash
ssh -L 6080:localhost:6080 root@YOURVPSIP
然后打开 http://localhost:6080/vnc.html → 点击 连接。
您将看到Chrome窗口实时显示。您和代理可以同时控制它。
在 ~/.openclaw/openclaw.json 中添加:
json
{
browser: {
enabled: true,
executablePath: /usr/bin/google-chrome-stable,
attachOnly: true,
headless: false,
noSandbox: true
}
}
然后重启:openclaw gateway restart
代理现在可以使用 browser 工具进行导航、点击、输入、截图等操作。
如果您需要代理(例如用于反验证码的移动代理),Chrome无法在 --proxy-server 中传递用户名/密码。解决方案:运行一个本地Python桥接器,自动注入认证信息进行转发。
bash
python3 -c
import socket, threading, base64, select
UPSTREAMHOST = PROXYIP # 例如 87.236.22.82
UPSTREAMPORT = PROXYPORT # 例如 19423
USERNAME = PROXY_USER
PASSWORD = PROXY_PASS
LOCAL_PORT = 18801
auth = base64.b64encode(f{USERNAME}:{PASSWORD}.encode()).decode()
def handle(client):
try:
data = b
while b\r\n\r\n not in data:
data += client.recv(4096)
upstream = socket.createconnection((UPSTREAMHOST, UPSTREAM_PORT))
if bProxy-Authorization not in data:
data = data.replace(b\r\n\r\n, f\r\nProxy-Authorization: Basic {auth}\r\n\r\n.encode(), 1)
upstream.sendall(data)
while True:
r, , = select.select([client, upstream], [], [], 30)
if not r: break
for s in r:
d = s.recv(65536)
if not d: return
(upstream if s is client else client).sendall(d)
except: pass
finally:
try: client.close()
except: pass
try: upstream.close()
except: pass
srv = socket.socket()
srv.setsockopt(socket.SOLSOCKET, socket.SOREUSEADDR, 1)
srv.bind((127.0.0.1, LOCAL_PORT))
srv.listen(50)
print(本地代理在 127.0.0.1:18801)
while True:
c, _ = srv.accept()
threading.Thread(target=handle, args=(c,), daemon=True).start()
&
然后使用代理重启Chrome:
bash
pkill -9 chrome
rm -f ~/.openclaw/browser/openclaw/user-data/SingletonLock
DISPLAY=:99 google-chrome-stable --no-sandbox --disable-gpu \
--remote-debugging-port=18800 \
--user-data-dir=~/.openclaw/browser/openclaw/user-data \
--window-size=1280,800 \
--proxy-server=http://127.0.0.1:18801 &
验证:让代理打开 https://api.ipify.org — 它应该显示代理IP,而不是VPS IP。
bash
ufw default deny incoming
ufw default allow outgoing
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw --force enable
noVNC(6080)、VNC(5900)和CDP(18800)都仅限于本地 — 从不公开暴露。
所有进程(Xvfb、x11vnc、websockify、Chrome)都必须重新启动。让代理执行:
在VPS上启动浏览器堆栈
代理应运行此技能中的步骤2命令。
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 browser-vps-setup-skill-1776419960 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 browser-vps-setup-skill-1776419960 技能
skillhub install browser-vps-setup-skill-1776419960
文件大小: 2.95 KB | 发布时间: 2026-4-17 18:54