-
Notifications
You must be signed in to change notification settings - Fork 0
deployment
Wiki Maintainer edited this page Aug 5, 2026
·
1 revision
REX 支持三种部署方式:Docker、二进制、配置文件。
docker run -d \
--name rex-hub \
-p 8080:8080 \
-v rex-data:/data \
jeelin/rex-hub:latestversion: '3.8'
services:
rex-hub:
image: jeelin/rex-hub:latest
container_name: rex-hub
ports:
- "8080:8080"
volumes:
- rex-data:/data
restart: unless-stopped
volumes:
rex-data:| 变量 | 说明 | 默认值 |
|---|---|---|
REX_DATA_DIR |
数据目录 | /data |
REX_SECRET_KEY |
加密密钥 | 自动生成 |
REX_LISTEN_ADDR |
监听地址 | 0.0.0.0:8080 |
从 GitHub Releases 下载对应平台的二进制文件。
支持平台:
- Linux (x86_64, aarch64)
- macOS (x86_64, aarch64)
- Windows (x86_64)
# Linux / macOS
./rex-hub
# Windows
rex-hub.exe首次启动会在当前目录创建 data/ 目录存放配置和数据库。
- 在 Hub 控制台创建环境,获取注册令牌
- 在目标服务器部署 Agent 二进制
# 使用注册令牌启动
./rex-agent --token <registration-token> --hub-url https://your-hub.comdocker run -d \
--name rex-agent \
-e REX_HUB_URL=https://your-hub.com \
-e REX_REGISTRATION_TOKEN=<token> \
jeelin/rex-agent:latest- Linux/macOS:
~/.config/rex/config.toml - Windows:
%APPDATA%\REX\config.toml
[server]
listen_addr = "0.0.0.0:8080"
[data]
dir = "/var/lib/rex"
[auth]
session_timeout = 3600
[update]
auto_check = true打开浏览器访问 http://localhost:8080
首次访问需要设置管理员密码。
- 进入「环境」页面
- 点击「新建环境」
- 填写名称、描述
- 选择连接方式(直连或 Agent 代理)
- 在环境详情页点击「新建资源」
- 选择协议类型(SSH/MySQL/Redis 等)
- 填写连接信息
- 测试连接
- 保存
- 进入工作空间
- 在左侧连接树选择资源
- 双击打开对应控制台
推荐使用 Nginx 或 Caddy 进行 TLS 终止:
server {
listen 443 ssl;
server_name rex.example.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /ws/ {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}REX 也支持内置 TLS 配置:
[server.tls]
enabled = true
cert_file = "/path/to/cert.pem"
key_file = "/path/to/key.pem"