SimpleX Chat 7.0.4 配置参数详解
对 SimpleX Chat 配套服务端 smp-server 与 xftp-server(v7.0.1)两份 INI 配置全量参数逐项讲解,关键项均附修改-重启-验证闭环实测回显,并覆盖客户端 CLI 数据库与日志参数。
SimpleX Chat 7.0.4 配置参数详解
目标:对 SimpleX Chat v7.0.4 配套服务端
smp-server与xftp-server(v7.0.1,构建 27a3738)的两份 INI 配置文件做全量参数讲解,关键参数均给出"修改 → 重启 → 验证"闭环实测回显,并覆盖客户端 CLI 的数据库与日志参数。部署形态见《SimpleX Chat 7.0.4 Docker Compose 部署指南》,定位与选型见《SimpleX Chat 7.0.4 介绍与选型指南》。
一、环境信息
| 项目 | 内容 |
|---|---|
| 服务端系统 | Ubuntu 22.04(systemd 管理服务) |
| 服务端程序 | smp-server v7.0.1.0(构建 27a3738)、xftp-server v7.0.1.0 |
| 服务端 INI | /etc/opt/simplex/smp-server.ini、/etc/opt/simplex-xftp/file-server.ini |
| systemd 服务 | smp-server.service、xftp-server.service |
| 客户端 | SimpleX Chat CLI v7.0.4(Ubuntu 22.04,另一台内网终端) |
| 服务端地址 | smp 中继 10.89.61.10:5223 / 文件中继同机 443 |
二、配置文件与生效方式
两份 INI 均在服务端初始化(smp-server init / xftp-server init)时生成:
/etc/opt/simplex/smp-server.ini # 消息中继配置
/etc/opt/simplex-xftp/file-server.ini # 文件中继配置
生效方式为"改文件 → 重启服务 → 看日志回显",日志可直接验证参数是否被读到:
systemctl restart smp-server
journalctl -u smp-server --since "1 min ago" --no-pager -o cat
两条语法约定(实测模板两种并存,均可):
- 键值分隔用
=或:(如[NAMES]段的enable: off与[AUTH]段的new_queues = on)。 - 注释行(
#开头)即官方默认值;想启用某项,去掉#并按需改值。
⚠️ 指纹与证书不随参数修改变化(只改 INI 不触碰证书文件),客户端已分发的服务器地址不会失效;反之删除证书与 INI 重新初始化则会换指纹。
三、smp-server.ini 全量参数
3.1 [INFORMATION] 段——服务器公开信息
| 参数 | 默认 | 说明 |
|---|---|---|
| source_code | 无注释默认 | AGPLv3 要求:修改过源码必须提供源码地址;未设置时启动日志出 Warning |
| usage_conditions | 注释 | 使用条款链接,建议指向 PRIVACY.md |
| condition_amendments | 注释 | 条款补充修订链接 |
| server_country / operator / operator_country / website | 注释 | 运营者与服务器所在地(ISO-3166 两字码) |
| admin_simplex / admin_email / admin_pgp / admin_pgp_fingerprint | 注释 | 管理员联系方式 |
| complaints_simplex / complaints_email / complaints_pgp / complaints_pgp_fingerprint | 注释 | 投诉与反馈联系方式 |
| hosting / hosting_country | 注释 | 托管服务商信息 |
| hosting_type | virtual | 托管类型:virtual / dedicated / colocation / owned |
这些字段会随静态信息页一起公开,全部可省略;但只要填了任意一个附加字段,source_code 就必须存在。
3.2 [STORE_LOG] 段——存储与统计
| 参数 | 实测生效值 | 默认 | 说明 |
|---|---|---|---|
| enable | on | off | 追加式 store log,重启后恢复队列记录;启动时压缩(清理已删对象) |
| store_queues | memory | memory | 队列存储模式:memory(内存 + 可选日志)或 database(PostgreSQL,需 db_connection) |
| db_connection / db_schema / db_pool_size | 注释 | postgresql://smp@/smp_server_store 等 | PostgreSQL 连接参数,仅 store_queues = database 时使用 |
| db_store_log | 注释 | off | database 模式下是否把变更写 store log |
| db_deleted_ttl | 注释 | 21 | 已删队列在数据库中的保留天数 |
| store_messages | memory | memory | 消息存储模式:memory 或 journal |
| restore_messages | on | off | memory 模式下未送达消息在重启前落 .bak 并恢复 |
| expire_messages_days | 21 | 21 | 队列内未取消息过期天数(实测可改,见 4.2) |
| expire_messages_on_start | on | on | 启动时清理过期消息 |
| expire_messages_on_send | off | off | 投递时清理过期消息 |
| expire_ntfs_hours | 24 | 24 | 通知记录过期时间 |
| log_stats | on | off | 每日统计落 CSV |
| prometheus_interval | 注释 | 60 | Prometheus 实时指标输出间隔(秒) |
3.3 [AUTH] 段——建队授权与控制端口口令
| 参数 | 实测生效值 | 默认 | 说明 |
|---|---|---|---|
| new_queues | on | on | off 时完全禁止新建队列(退役场景,见 4.4 实测) |
| create_password | 按部署设置 | 无 | 建队口令,客户端地址写成 smp://指纹:口令@主机 |
| control_port_admin_password | 无 | 无 | 控制端口管理员口令(见 4.5 实测) |
| control_port_user_password | 无 | 无 | 控制端口只读用户口令 |
| daily_block_queue_quota | 注释 | 20 | 经控制端口每日可封锁队列数;0 不限,-1 禁止封锁 |
3.4 [TRANSPORT] 段——监听与端口
| 参数 | 实测生效值 | 默认 | 说明 |
|---|---|---|---|
| host | 按部署设置 | 无 | 仅用于启动时打印服务器地址,可填多个 |
| port | 5223 | 5223 | 监听端口,可写多个(5223,443),见 4.1 实测 |
| log_tls_errors | off | off | 记录 TLS 握手错误,排查连接问题时打开 |
| websockets | off | off | 额外跑 websockets 端口;官方标注已弃用仅测试用 |
| control_port | 注释 | 5224 | 控制端口,启用后可远程查看状态(见 4.5) |
3.5 [PROXY] 段——中继转发(SMP proxy)
| 参数 | 默认 | 说明 |
|---|---|---|
| host_mode | public | 目标服务器多域名时优先的主机名形态:public 或 onion |
| required_host_mode | off | on 时只允许按 host_mode 指定形态连接 |
| own_server_domains | 空 | 自营中继域名后缀(空格分隔),单独统计代理指标 |
| socks_proxy | 注释 | 转发用的 SOCKS 代理(如 localhost:9050),.onion 目标需 Tor |
| socks_mode | onion | onion 仅对 .onion 目标启用代理;always 对全部目标启用 |
| client_concurrency | 32 | 客户端并行代理命令线程上限 |
3.6 [NAMES] 段——公网命名空间解析
| 参数 | 实测生效值 | 默认 | 说明 |
|---|---|---|---|
| enable | off | off | 经 snrc-resolve.py REST 解析器提供公网命名空间解析 |
| resolver_endpoint | 注释 | http://127.0.0.1:8000 | 解析器地址(同机或反代 HTTPS) |
| resolver_auth | 注释 | 无 | basic 用户名:口令 |
| resolver_timeout_ms | 注释 | 3000 | 单次解析超时 |
| resolver_max_response_bytes | 注释 | 16000 | 响应上限 |
| resolver_concurrency | 注释 | 1000 | 每连接并发解析数 |
3.7 [INACTIVE_CLIENTS] 段——空闲断开
| 参数 | 实测生效值 | 默认 | 说明 |
|---|---|---|---|
| disconnect | on | on | 开启空闲客户端清理 |
| ttl | 21600 | 21600 | 空闲秒数阈值(6 小时),实测改 60 后日志立即反映(见 4.3) |
| check_interval | 3600 | 3600 | 巡检间隔(秒) |
3.8 [WEB] 段——服务器信息页
| 参数 | 实测生效值 | 默认 | 说明 |
|---|---|---|---|
| static_path | /var/opt/simplex/www | 同左 | 信息页静态文件生成目录 |
| http | 见 4.6 实测 | 注释 | 内嵌 HTTP 服务端口,启用后可直接访问信息页 |
| https / cert / key | 注释 | 无 | 内嵌 HTTPS 信息页(需证书),onion 部署不需要 |
四、smp-server.ini 修改-验证闭环(实测)
4.1 port 多端口与 443 冲突
把 port = 5223 改为 port = 5223,443 后重启:
Serving SMP protocol on port 5223 (TLS)...
binding to [::]:5223
Serving SMP protocol on port 443 (TLS)...
binding to [::]:443
⚠️ 实测冲突案例:同机还运行 xftp-server(监听 443)时,再让 smp-server 绑定 443 会启动失败,服务进入 failed 状态:
Network.Socket.bind: resource busy (Address already in use)
结论:443 只能给两个服务中的一个;同机部署时 smp-server 建议保留 5223 单端口(客户端地址显式带端口,不影响连接),或让 xftp-server 换端口。
4.2 expire_messages_days
改为 expire_messages_days = 7,重启后日志回显:
expiring messages after 7 days
改回 21 后回显 expiring messages after 21 days,参数即时生效于巡检逻辑。
4.3 INACTIVE_CLIENTS ttl
改为 ttl = 60,重启后回显:
expiring clients inactive for 60 seconds every 3600 seconds
⚠️ 该项控制的是"客户端与服务器之间的连接空闲回收",不影响已投递消息。
4.4 new_queues 停业开关
改为 new_queues = off 后重启,服务端回显:
creating new queues NOT allowed
客户端侧实测:/smp test <地址> 直接失败(建队即被拒):
SMP server test failed at CreateQueue, error: SMP {serverAddress = "smp://ml_GdNzOiCaM7rsJfxrAy6H_4-PFLOja4TqewPF3r8o=:0eqByp3FaLF8Kq7Wp69-74-l2cUJ0p8H1nca_8gqNZ8=@10.89.61.10:5223", smpErr = AUTH}
此时发起新连接(/connect)同样失败,回显:
error: connection authorization failed - this could happen if connection was deleted, secured with different credentials, or due to a bug - please re-create the connection
改回 on 后 /smp test 恢复 SMP server test passed。适合"退役服务器但存量连接还没迁完"的阶段。
4.5 control_port 控制端口
启用三行(官方模板用冒号语法):
control_port: 5224
control_port_admin_password: Admin-5224-Pass
control_port_user_password: User-5224-Pass
重启后日志回显 binding to 127.0.0.1:5224(默认只绑本机回环)。在服务器上实测控制协议会话(python3 socket 连接,逐条命令回显如下):
>> auth Admin-5224-Pass
SMP server control port
'help' for supported commands
Current role is CPRAdmin
>> server-info
Threads: 16
Clients: 0
Client queues (rcvQ, sndQ, msgQ): (0,0,0)
SMP subscriptions (via clients): 0
...
SMP subscribed clients count 2: 0
>> stats
fromTime: 2026-10-27 01:33:13.797043899 UTC
qCreated: 0
...
qCount: 0
qCount 2: 4
notifiers: 0
...
pMsgFwdsRecv: 0
rcvServiceCount: 0
ntfServiceCount: 0
rcvServiceQueuesCount: 0
ntfServiceQueuesCount: 0
>> clients
clientId,sessionId,connected,createdAt,rcvActiveAt,sndActiveAt,age,subscriptions
>> help
commands: stats, stats-rts, clients, sockets, socket-threads, threads, server-info, delete, save, help, quit
>> quit
要点:
- 登录命令是
auth <口令>,服务端按口令匹配返回Current role is CPRAdmin(管理员)或只读角色;写成AUTH admin <口令>会报error: Failed reading: bad ControlProtocol command(实测)。 server-info汇总线程/客户端/订阅状态,stats输出全量计数器(qCount 2: 4中 4 即当前队列数,与实测 4 个连接队列吻合),clients列出在线客户端,delete <队列>可经二次确认清理异常队列(受daily_block_queue_quota限制)。
4.6 WEB http 信息页
[WEB] 段 http 取消注释设为 http = 8000,重启后本机验证:
HTTP 200, 46787 bytes
页面标题:SimpleX Chat - Server Information
页面内容与 static_path 生成的静态文件一致(指纹、地址、二维码)。
五、file-server.ini 全量参数与修改-验证闭环
5.1 [INFORMATION] 段
与 smp-server.ini 的 [INFORMATION] 同构(source_code / server_country / operator / admin_* / complaints_* / hosting_* / hosting_type)。未设置 source_code 时启动日志实测回显:
Warning: server source code is not specified. Add 'source_code' property to [INFORMATION] section of INI file.
补上 source_code = https://github.com/simplex-chat/simplexmq 后重启,该行消失。
5.2 [STORE_LOG] 段
| 参数 | 实测生效值 | 默认 | 说明 |
|---|---|---|---|
| enable | on | off | 追加式 store log,重启恢复文件索引记录 |
| store_files | memory | memory | 文件索引存储:memory 或 database(PostgreSQL) |
| db_connection / db_schema / db_pool_size | 注释 | postgresql://xftp@/xftp_server_store 等 | database 模式连接参数 |
| db_store_log | 注释 | off | database 模式下写 store log |
| expire_files_hours | 48 | 48 | 文件分块过期小时数(实测见 5.5) |
| log_stats | off | off | 每日统计 CSV |
| prometheus_interval | 注释 | 60 | Prometheus 指标间隔 |
5.3 [AUTH] 段
| 参数 | 实测生效值 | 默认 | 说明 |
|---|---|---|---|
| new_files | on | on | off 时禁止上传新文件,但已存文件仍可下载(退役开关) |
| create_password | 按部署设置 | 无 | 上传口令,客户端地址写成 xftp://指纹:口令@主机 |
| control_port_admin_password / control_port_user_password | 无 | 无 | 控制端口口令(同 smp) |
5.4 [TRANSPORT] 段
| 参数 | 实测生效值 | 默认 | 说明 |
|---|---|---|---|
| host | 按部署设置 | 无 | 打印地址用 |
| port | 443 | 443 | XFTP 监听端口 |
| log_tls_errors | off | off | TLS 错误日志 |
| control_port | 注释 | 5226 | 控制端口(注意默认与 smp 的 5224 不同) |
5.5 [FILES] 与 [INACTIVE_CLIENTS] 段
| 参数 | 实测生效值 | 默认 | 说明 |
|---|---|---|---|
| path | /srv/xftp | /var/opt/simplex-xftp/files | 文件分块存储目录 |
| storage_quota | 10gb | 0(不限) | 配额,支持 10gb 等单位 |
| disconnect | off | off | xftp 默认不清理空闲客户端 |
| ttl / check_interval | 注释 | 21600 / 3600 | 同 smp 语义 |
实测修改-验证(重启 xftp-server 后日志回显):
# expire_files_hours = 24
expiring files after 1 days
# storage_quota = 20gb
Total / available storage: 21474836480 / 21474705408
改回默认后分别回显 expiring files after 2 days 与 Total / available storage: 10737418240 / 10737418240。
5.6 [WEB] 段
| 参数 | 默认 | 说明 |
|---|---|---|
| static_path | /var/opt/simplex-xftp/www | 信息页静态文件目录 |
| http | 注释 | 内嵌 HTTP 信息页端口 |
| cert / key | 注释 | 与 XFTP 同端口跑 HTTPS 信息页所需证书 |
六、客户端数据库与日志参数
客户端关键启动参数(simplex-chat --help 口径,v7.0.4):
| 参数 | 默认 | 说明 |
|---|---|---|
| -d, --database DB_FILE | /root/.simplex/simplex_v1 | SQLite 数据库路径前缀,会派生两个库文件 |
| -k, --key KEY | 无 | 数据库加密口令 |
| -c, --connections N | 4 | 代理客户端连接池大小 |
| -t, --temp | 关 | 使用临时数据库 |
| -e, --execute CMD | 无 | 执行单条命令后退出(见 6.3) |
| -l, --log-level LEVEL | important | 日志级别:debug / info / warn / error / important |
| --log-file FILE/DEVICE | 无 | 日志输出到指定文件或设备 |
| --log-tls-errors | 关 | 记录连接层 TLS 错误 |
| --log-agent | 关 | 输出 SMP 代理日志 |
| --log-hosts | 关 | 输出网络主机日志 |
| -s, --server SRV_LIST | 官方预置 | SMP 服务器列表(预置仅新档案生效,配置过的档案以 /smp 设置为准) |
| --xftp-servers SRV_LIST | 官方预置 | XFTP 服务器列表 |
6.1 -d 数据库布局实测
simplex-chat -d /root/b2-alice.db 启动后,数据落为两个 SQLite 文件(实测清单):
b2-alice.db_agent.db # SMP/XFTP 代理层:连接、队列、消息事件
b2-alice.db_chat.db # 会话层:联系人、群组、消息、发送队列
迁移/备份即拷贝这两个文件;换 -d 路径等于换一套全新档案。
6.2 日志级别与终端输出
默认 -l important 只输出关键事件,日志走终端;-l info 起输出连接与代理层明细。排查问题时组合示例(--help 口径):-l debug --log-tls-errors --log-agent。
6.3 -e 单命令模式实测
新库首启需先建档案,实测(新库 c1demo + 对自建服务器连通性测试,档案名经标准输入提供):
$ printf "c1demo\n" | simplex-chat -d /tmp/c1-demo.db -l info --log-file /tmp/c1-demo.log -e "/smp test smp://H2Z_jKo6JIjojuUI3bD3p9XHgRlhS3e_fxV-2FcPWoE=:q1w2e3r4@10.89.62.10:5223"
display name: Current user: c1demo
SMP server test passed
适合写进巡检脚本做服务器健康检查。实测附带观察:该 -e 模式运行未生成 --log-file 指定的日志文件,该参数行为以 --help 口径为准(输出到指定文件或设备),建议正式巡检依赖命令回显而非日志文件。
七、参数备份与回滚
改参数前先留备份,误改可秒回(实测闭环):
cp /etc/opt/simplex/smp-server.ini /root/smp-server.ini.bak
# 误改:expire_messages_days = 9 → 重启后日志 expiring messages after 9 days
cp /root/smp-server.ini.bak /etc/opt/simplex/smp-server.ini
systemctl restart smp-server
# 回滚后日志 expiring messages after 21 days
xftp-server 同理(file-server.ini)。注意 journalctl 的验证窗口要收紧(如 --since "30 seconds ago"),避免把上一次重启的日志行混进判断。
八、常见问题(FAQ)
Q1:smp-server 与 xftp-server 能共用 443 吗?
不能。同机部署时两者监听端口不得重复,实测在 smp-server.ini 写 port = 5223,443 而被 xftp-server 抢先占用时,服务 failed,日志 Network.Socket.bind: resource busy (Address already in use)。让 smp 保留 5223(客户端地址带端口)即可。
Q2:改了 INI 但没生效?
必须重启对应 systemd 服务(systemctl restart smp-server / xftp-server);参数只在启动时读取。验证以 journalctl 最新一次启动日志为准。
Q3:控制端口登录报 bad ControlProtocol command?
登录命令是 auth <口令>(小写、单参数),不是 AUTH admin <口令>。INI 中键名与值建议用冒号分隔(与官方模板一致):control_port_admin_password: <口令>。
Q4:new_queues = off 影响存量连接吗?
不影响既有队列的收发,只拒绝"新建队列"(新连接、新邀请、/smp test 的建队探测都会失败)。适合服务器退役前的过渡期。
Q5:store_queues / store_messages 的 memory 与 database 怎么选?
memory(默认):全内存 + store log/.bak 恢复,重启不丢队列;database:接入 PostgreSQL,适合大规模实例,且要求 store_messages = journal。中小规模自托管用默认即可。
Q6:expire_messages_days 改小会立即删消息吗?
过期消息在巡检与投递流程中清理;expire_messages_on_start = on 时启动即清。改小前确认队列内没有尚未拉取的消息。
九、参考链接
- 《SimpleX Chat 7.0.4 介绍与选型指南》:https://www.quzuo.net/document/LsjsWxVptIAh
- 《SimpleX Chat 7.0.4 Docker Compose 部署指南》:https://www.quzuo.net/document/wthVPGVL9bt9
- 服务端部署文档:https://simplex.chat/server.html 、https://simplex.chat/xftp.html(检索日期 2026-10-27)
- 服务端源码(配置实现与模板):https://github.com/simplex-chat/simplexmq