Hosting Notes
Self-Hosted Agents

Running Multiple OpenClaw Instances on One VPS Without Collisions

Yes, you can run multiple OpenClaw instances on one VPS — each instance just needs its own state directory, its own gateway port, and its own messaging credentials. Get those three separated and two to four independent agents will share a small KVM box without stepping on each other.

On this page
  1. What collides when you clone an instance
  2. Pick your isolation level: profiles, users, or containers
  3. Ports, subdomains, and TLS for each gateway
  4. Keep them alive with systemd template units
  5. Sizing: RAM and disk are the real ceiling
  6. Frequently asked questions
  7. Related reads

Cloning an OpenClaw install is easy. Cloning it cleanly is where people get stuck, because a second process inherits the first one's defaults: same config folder, same port, same bot token. Below is the map of what breaks and the fixes that hold up over months, not days.

What collides when you clone an instance

OpenClaw keeps almost everything in a single state directory in the user's home folder. Start a second gateway as the same user and it reads the same config, writes the same session logs, and tries to bind the same port. Five things conflict:

ResourceShared by defaultFix
State directory~/.openclawOne directory per instance
Gateway portFirst free default portExplicit, unique port per instance
Channel credentialsSame bot token or phone numberSeparate bot/number per instance
Browser profileSame Chromium user-data dirPer-instance browser data path
Workspace filesSame project folderPer-instance workspace

The port and the state directory cause the obvious failures: EADDRINUSE, or two agents answering the same message. The browser profile causes the subtle one. You get file locks and corrupted sessions, plus an agent that randomly loses its logged-in web state.

Where we host this site

The plan behind Hosting Notes

Same 4 GB VPS and LiteSpeed stack we benchmark in these guides.

See Hostinger plans

Pick your isolation level: profiles, users, or containers

  • Environment variables (lightest). Point each instance at its own state directory and port via env vars or a profile flag, then launch each with a small wrapper script. Fast to set up. Everything still runs as one Linux user, though, so a bad script can touch a sibling's files.
  • Separate Linux users (balanced). Create openclaw-a, openclaw-b, and so on, each with a home directory under /srv/. File permissions become your isolation boundary. This works well for a handful of personal agents.
  • Docker containers (heaviest). One container per instance with a volume mount for state and a published port. Most reproducible, and the easiest to rebuild after a botched upgrade, at the cost of more moving parts and a bit of RAM overhead per container.

Whichever level you choose, never let two instances share a messaging identity. A Telegram bot token or WhatsApp session maps to one gateway. A duplicate connection will disconnect or loop. Provision a separate bot per agent; it takes a minute in BotFather and saves an afternoon of debugging.

Ports, subdomains, and TLS for each gateway

Assign a fixed port per instance (4201, 4202, 4203) and bind each gateway to 127.0.0.1 only. Never expose those ports directly to the internet; the control UI should sit behind a reverse proxy with a real certificate.

  1. Create an A record per agent, e.g. agent1.example.com.
  2. Add one reverse-proxy block per subdomain, each proxying to its own local port.
  3. Enable WebSocket upgrade headers. The control UI and live message streams need them.

Subdomains beat path prefixes here. Path rewriting breaks WebSocket handshakes and cookie scope far more often than it saves you, and certificates are free anyway.

Note

Set a log rotation policy on the state directories before you add a third instance. Session and gateway logs grow quietly, and a full disk takes down every agent on the box at once, not just the noisy one.

Keep them alive with systemd template units

One template unit handles every instance. Name the file [email protected] and drop a matching /etc/openclaw/agent1.env for each agent's ports and state path (adjust variable names to match your build):

[Unit]
Description=OpenClaw instance %i
After=network.target

[Service]
Type=simple
User=openclaw
EnvironmentFile=/etc/openclaw/%i.env
ExecStart=/usr/bin/openclaw gateway start
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

Then systemctl enable --now openclaw@agent1, repeat for each name, and you get independent restarts and logs via journalctl -u openclaw@agent1, with no shared crash domain.

Sizing: RAM and disk are the real ceiling

Model inference happens remotely, so CPU load stays low. Memory goes to Node processes and headless Chromium. Two agents with browser automation enabled can use noticeably more RAM than four text-only ones, so count browser sessions, not instances.

  • Text-only agents: comfortable on an entry KVM plan with a couple of GB of RAM.
  • Any agent driving a real browser: budget a meaningful chunk of RAM each and add swap as a safety net.
  • Storage: NVMe matters for workspace churn and logs; 25–50 GB is plenty for a few agents.

Start with two instances on a Hostinger VPS, watch free -h and df -h for a week, then add the third. Scaling up a plan later is a reboot; untangling a shared state directory is a weekend.

Frequently asked questions

Can two OpenClaw instances share the same Telegram bot token?

No. A bot token maps to a single active gateway connection, so a second instance using it will disconnect or loop. Create a separate bot for each agent and give each one its own token.

How many OpenClaw instances fit on one VPS?

It depends on whether the agents use browser automation. Text-only agents are light and several fit on a small KVM plan; headless Chromium is the memory hog, so count active browser sessions rather than instance count and check free memory before adding another.

Do I need a separate domain for each instance?

No. Subdomains of one domain are the cleanest option — one A record per agent, one reverse-proxy block per subdomain. Avoid path-prefix routing, which frequently breaks WebSocket upgrades and cookie scope.

Should I use separate Linux users or Docker containers?

Separate Linux users give you file-level isolation with almost no overhead and suit a handful of personal agents. Containers are worth the extra complexity when you need reproducible rebuilds or run untrusted tools inside an agent.

How do I restart just one agent?

With systemd template units, run systemctl restart openclaw@agent1. Each instance has its own unit, its own process, and its own journal stream, so failures and restarts stay isolated.

Ready to get started? Check out Hostinger's plans.

Ron

Infrastructure writer & self-hosting practitioner

I run production sites and small VPS boxes for a living — WordPress, Docker, reverse proxies and the backups that save you at 2am. Everything here is written from setups I actually maintain.

Affiliate disclosure. Some links on this page are affiliate links. If you buy through them we may earn a commission at no extra cost to you. We only recommend hosts we have paid for and tested. Read the full disclosure