Source: https://proxvn.io.vn/docs/cli

# CLI reference

This page is a command reference. The [complete client guide](https://proxvn.io.vn/docs/client) walks through installation, localhost checks, account setup, background services and removal.

Everything has sensible defaults — most of the time all you need is ` proxvn http <port> `.

**Upgrading from 8.x to 9.x:** upgrade the server and every client together. All 8.x TCP, HTTP and UDP clients are incompatible with this release. Existing Console sessions must sign in again; changing a password also invalidates that account's sessions.

## Commands

| Command | Description |
| --- | --- |
| ` proxvn ` | Interactive setup when run in a terminal without an existing config; otherwise use configured defaults |
| ` proxvn http <port> ` | HTTP/HTTPS tunnel — WebSockets, SSE and large uploads supported |
| ` proxvn tcp <port> ` | Raw TCP tunnel (SSH, RDP, MySQL, PostgreSQL, Redis…) |
| ` proxvn udp <port> ` | AES-GCM encrypted UDP tunnel for games and realtime apps |
| ` proxvn share <folder> ` | Share a folder over web + WebDAV with a generated password |
| ` proxvn login <api-key> ` | Link tunnels to your account (key from the Console) |
| ` proxvn logout ` | Remove the key in ` ~/.proxvn/config.json `; environment tokens and keys in other files remain |
| ` proxvn lang en\|vi ` | Switch the CLI language |
| ` proxvn mcp ` | Run the MCP server for AI agents |
| ` proxvn version ` | Print the version |

## Flags

| Flag | Default | Meaning |
| --- | --- | --- |
| ` --config ` | auto-discover | Read defaults from a specified JSON file |
| ` --proto ` | ` tcp ` | ` http `, ` tcp ` or ` udp `; normally selected by the subcommand |
| ` --port ` | ` 80 ` | Local port; a positional port also works |
| ` --token ` | environment/config | Account API key; no token means an anonymous tunnel |
| ` --subdomain ` | random | Preferred HTTP subdomain (3–32 chars: a-z, 0-9, -) |
| ` --host ` | ` localhost ` | Forward to another machine on your LAN, e.g. ` 192.168.1.10 ` |
| ` --server ` | ` tunnel.proxvn.io.vn:8882 ` | Tunnel server address; set this for a self-hosted server |
| ` --cert-pin ` | automatic | Override the server certificate pin. Normally not needed: official servers are pinned in the client and self-hosted servers are remembered on first connect |
| ` --insecure ` | ` false ` | Disable certificate verification, including pinning; testing only |
| ` --id ` | hostname | Display name in the Console |
| ` --ui=false ` | ` true ` | Plain log output instead of the live terminal UI |
| ` --lang ` | auto | ` en ` or ` vi ` (also ` PROXVN_LANG `) |
| ` --file ` | off | Share a directory; equivalent to ` proxvn share <folder> ` |
| ` --permissions ` | ` rw ` | ` r ` reads; ` rw ` also writes/deletes; ` rwx ` currently has the same file operations and does not execute programs |
| ` --user `, ` --pass ` | ` proxvn `, generated | Credentials for shared folders |

## Config file

ProxVN uses the first readable, valid JSON config: an explicit ` --config ` path, or otherwise ` PROXVN_CONFIG `, ` proxvn.json ` beside the binary, ` proxvn.json ` in the working directory, then ` ~/.proxvn/config.json `. Files are not merged. An explicit path disables fallback to the other locations.

Flags override config values, which override built-in defaults. For the API key the order is ` --token ` → ` PROXVN_TOKEN ` → config ` token `. Language uses ` --lang ` → ` PROXVN_LANG ` → config ` lang ` → ` LC_ALL `/` LC_MESSAGES `/` LANG `, falling back to English. Built-in forwarding defaults are ` localhost:80 `, TCP and terminal UI enabled.

```
{
  "server": "tunnel.proxvn.io.vn:8882",
  "proto": "http",
  "port": 3000,
  "subdomain": "myshop",
  "lang": "en",
  "token": "pvn_xxx (written by proxvn login)"
}
```

Certificate pin order is an explicit/configured ` cert_pin `, then the official server's built-in pin, then the host:port entry in ` ~/.proxvn/known_servers.json `. A new self-hosted server is trusted on first use; independently verify its initial SHA-256 fingerprint when authenticity matters.

## Run in the background

### Linux (systemd)

```
# /etc/systemd/system/proxvn-myapp.service
[Unit]
Description=ProxVN tunnel for myapp
After=network-online.target

[Service]
ExecStart=/usr/local/bin/proxvn http 3000 --subdomain myapp --ui=false
Restart=always
RestartSec=3
User=youruser

[Install]
WantedBy=multi-user.target
```

Replace ` youruser ` with the Linux account that installed ProxVN and saved its login. Run ` command -v proxvn ` and use that absolute binary path in ` ExecStart `; the installer may choose ` ~/.local/bin `. For account tunnels, specify that user's absolute config path with ` --config `. See the [complete background-service example](https://proxvn.io.vn/docs/client#background).

```
sudo systemctl daemon-reload
sudo systemctl enable --now proxvn-myapp
sudo systemctl status proxvn-myapp --no-pager
sudo journalctl -u proxvn-myapp -n 50 --no-pager
```

### Windows

Put a shortcut to ` proxvn.exe http 3000 --ui=false ` in ` shell:startup `, or use Task Scheduler with an "At log on" trigger.

### Docker Compose

Prepare the executable on Linux, or a Linux/WSL2 environment with the same architecture as the container. Run these commands in the Compose project directory. The installer selects the matching Linux build and verifies SHA-256 before you copy it into the mounted file. Windows/macOS executables cannot run in a Linux container.

```
curl -fsSL https://proxvn.io.vn/install.sh -o /tmp/proxvn-install.sh
less /tmp/proxvn-install.sh
sh /tmp/proxvn-install.sh
export PATH="$HOME/.local/bin:$PATH"
install -m 0755 "$(command -v proxvn)" ./proxvn-linux
./proxvn-linux version
```

Press ` q ` to leave ` less ` after reading the script. Add this client service to an existing Compose project with a ` web ` service listening on port 80 on the same network:

```
services:
  tunnel:
    image: alpine:3.20
    volumes:
      - ./proxvn-linux:/usr/local/bin/proxvn:ro
    command: ["/usr/local/bin/proxvn", "http", "80", "--host", "web", "--ui=false"]
    restart: unless-stopped
```

The ` ./proxvn-linux ` executable must match the container's architecture. The numeric port and ` --host ` are separate arguments. The client makes outbound connections; it needs no published container port. See the [installation and verification instructions](https://proxvn.io.vn/docs/client#install) if preparation fails.

## Automatic reconnect

If the network drops, the client retries with backoff from 2s to 30s plus jitter (folder sharing: 3s to 30s). Addresses are held for 10 minutes for anonymous tunnels or 24 hours for account tunnels. See [addresses and reconnects](https://proxvn.io.vn/docs/addresses) for the reservation rules.

[← Complete client guide](https://proxvn.io.vn/docs/client)[Accounts & reserved names →](https://proxvn.io.vn/docs/account)
