Collabora Online 26.04.5.1.1 配置参数详解

coolwsd.xml 26.04.5.1 全参数域逐项详解(含义/官方默认值/实测行为):网络、TLS、WOPI 白名单、资源进程、日志、安全、AI 新特性与 8-16GB 生产配置模板。

Collabora OnlineCollabora Online2026/10/22

Collabora Online 26.04.5.1.1 配置参数详解

目标:逐域讲清 Collabora Online(CODE)26.04.5.1 主配置文件 coolwsd.xml 的参数体系——每个参数的含义、官方默认值与实测生效行为,并给出可直接落地的生产配置模板。文中所有默认值均取自 26.04.5.1 实际生成的配置文件(该文件对每个参数自带 desc 说明与 default 属性),关键参数均附实测验证回显;部署过程见 《Collabora Online 26.04.5.1.1 Docker Compose 部署指南》,命令行工具见 《Collabora Online 26.04.5.1.1 常用 CLI 命令与工具详解》。

一、环境信息

  • 组件版本:Collabora Online(CODE)26.04.5.1(/hosting/capabilities 实测返回 productVersion: 26.04.5.1)
  • 主配置文件:/etc/coolwsd/coolwsd.xml(RPM/DEB 装与官方发行形态路径一致)
  • 实测环境:Ubuntu 22.04(x86_64),coolwsd 以默认参数启动
  • 实测生成的配置文件规模:466 行,参数带内嵌 desc(含义)与 default(官方默认值)双注释
  • 文档引擎验证接口:/hosting/capabilities(版本与能力 JSON)、/hosting/discovery(WOPI 发现 XML)、/cool/convert-to(格式转换)
  • 组件定位与选型背景见 《Collabora Online 介绍与选型指南》

二、前置条件

  1. coolwsd 已安装并可启动(裸机安装后由 systemd 托管,服务名 coolwsd;其他部署形态见部署篇)。启动验证:

    systemctl is-active coolwsd
    

    预期输出 active(服务在运行)。

  2. 能访问本机服务端口(默认 9980)做验证:

    curl -s http://localhost:9980/hosting/capabilities | head -c 120; echo
    

    实测回显(本文实测环境端口映射后为 8145,下文同):

    {"convert-to":{"available":true,"endpoint":"/cool/convert-to"},"hasDocumentSigningSupport":true,"hasMobileSupport":true,"hasProxyPrefix":false
    
  3. 了解 coolwsd 的进程模型(理解参数的前提):coolwsd 是常驻调度进程,为每份打开的文档派生沙箱化的 kit 子进程(内嵌 LibreOffice 引擎),内存占用随并发文档数线性增长——因此资源类参数(第五章 5.4)是生产调参重点。

三、参数查看与修改方式

coolwsd 的参数有三个入口,优先级从高到低为:命令行参数 > 配置文件 > 内置默认值。配置变更后需重启 coolwsd 服务生效。

3.1 配置文件 coolwsd.xml

主配置文件为 /etc/coolwsd/coolwsd.xml,XML 结构按功能域分层(<net>、<ssl>、<storage>、<logging> 等),每个参数节点带 desc(含义)与 default(默认值)属性。查看某一域的当前值:

grep -A3 '<ssl ' /etc/coolwsd/coolwsd.xml

实测回显(26.04.5.1 生成文件节选,enable 默认为 true):

    <ssl desc="SSL settings">
        <!-- switches from https:// + wss:// to http:// + ws:// -->
        <enable type="bool" desc="Controls whether SSL encryption between coolwsd and the network is enabled (do not disable for production deployment). If default is false, must first be compiled with SSL support to enable." default="true">true</enable>

修改方式:直接编辑 XML 元素的文本值(如把 <enable> 的 true 改 false),保存后重启服务。

3.2 命令行参数 --o 覆盖

coolwsd 启动参数支持 --o:配置路径=值 形式就地覆盖任意配置项,无需改文件。systemd 部署时通过 drop-in 追加:

systemctl edit coolwsd

写入:

[Service]
Environment=COOLWSD_EXTRA_PARAMS=--o:num_prespawn_children=2

(并在 unit 的 ExecStart 行追加 $COOLWSD_EXTRA_PARAMS 后 systemctl daemon-reload。)

实测验证(本文实测环境以该参数启动后,启动日志会打印全部非默认值清单,目标行如下):

        num_prespawn_children: 2

默认值为 4,覆盖为 2 后 dump 显示 2,证明 --o: 路径覆盖生效。多参数用空格分隔,如 --o:ssl.enable=false --o:ssl.termination=true。

3.3 变更生效与验证

重启服务并核对启动日志中的非默认值 dump(coolwsd 启动完成前会打印一份「Loaded config file ... (non-default values)」清单,是核对参数是否生效的最直接证据):

systemctl restart coolwsd
journalctl -u coolwsd --no-pager | grep -A30 'non-default values'

实测回显节选(本文实测,<redacted> 为敏感值自动打码):

        admin_console.password: <redacted>
        admin_console.username: <redacted>
        alias_groups[@mode]: groups
        num_prespawn_children: 2
        experimental_features: true

💡 说明:这份 dump 只列「与内置默认不同的项」——某参数没出现在 dump 里,说明它正使用官方默认值。这是排障时判断「配置到底生效没有」的第一现场。

四、参数总览

coolwsd.xml 按 XML 顶层域组织,各域职责与关键参数如下(域名为配置文件中的节点名,官方默认值以 26.04.5.1 生成文件为准):

域职责关键参数(默认值)
net监听协议/地址、访问控制、CSPproto=all、listen=any、connection_timeout_secs=30
sslcoolwsd 自身 TLSenable=true、termination=false、min_protocol_version=TLSv1.2
storageWOPI 存储侧与白名单wopi.allow=true、alias_groups@mode=first、max_file_size=0
per_document单文档资源与生命周期max_concurrency=4、idle_timeout_secs=3600、autosave_duration_secs=300
per_view单视图(浏览器页签)行为idle_timeout_secs=900、out_of_focus_timeout_secs=300
logging日志级别与落盘level=warning、level_startup=trace、file 默认关闭
security隔离与安全开关seccomp=true、capabilities=true、jwt_expiry_secs=1800、宏默认禁用
admin_console管理控制台enable=true、PAM 认证默认关
user_interface界面形态mode=default、default_zoom=100
watermark文档水印opacity=0.2、text 默认空
languagetool / deepl远程语法检查 / 翻译均 enabled=false
ai26.04 新增 AI 助手enabled=false、allow_user_settings=true
remote_links / indirection_endpoint26.04 集群协同/间接路由enable=false、migration_timeout_secs=180
home_mode家庭模式限流enable=false(开启后并发连接限 20、并发文档限 10)
memproportion / num_prespawn_children内存占比与预派生80.0 / 4

💡 技术拓展:「配置生效层级」不止 coolwsd.xml 一种载体,同类方案横向对比——

载体生效方式适用场景
配置文件重启服务后长期生效生产标准做法
命令行 --o随进程启动生效,不改文件临时验证、发行版注入(部署篇环境变量即走此通道)
管理控制台在线改部分项,重启后以文件为准快速查看与少量调整

本文主线采用配置文件方式(生产可审计、可版本化)。

五、核心参数分类详解

5.1 网络域 net(监听与访问控制)

做什么:控制 coolwsd 监听的协议与地址、POST/REST 访问来源、文档内外部数据源白名单与内容安全策略。预期结果:理解反代部署与内网访问控制的配置点。

参数默认值说明与实测
net.protoall监听 IPv4/IPv6/all。官方注释提示:localhost 先解析到 ::1 的系统上若配 loopback 监听要改 IPv4,否则只绑 [::1]
net.listenanyany 监听全部地址,loopback 仅本机。反代同机部署可收紧为 loopback
net.service_root空为所有 URL 加子路径前缀(如 /cool),用于共享域名下的子路径发布
net.post_allow私网四段POST/REST(含 convert-to)的客户端 IP 白名单,默认放行 192.168.0.0/16、127.0.0.1/32、::1/128、172.16.0.0/12、10.0.0.0/8
net.lok_allow私网四段+localhost文档内部访问外部数据源的白名单(=WEBSERVICE()、插入图形等),默认同上
net.content_security_policy空自定义 CSP 头;反代/iframe 集成场景需配 frame-ancestors 指定可嵌入宿主
net.frame_ancestors空已废弃(OBSOLETE),功能并入 content_security_policy
net.connection_timeout_secs30coolwsd 主动发起的连接(如 WOPI 回调)超时
net.proxy_prefixfalseProxyPrefix 模式,官方注明「radically changes how online works, should not be used in production」

实测行为:反代 TLS 终结部署时 coolwsd 本体用 HTTP,此时浏览器 → 反代是 HTTPS、反代 → coolwsd 是 HTTP,需配合 ssl.termination=true(见 5.2),本文部署篇实测 --o:ssl.enable=false --o:ssl.termination=true 后 HTTP 直访返回 200。

5.2 TLS 域 ssl(自身加密)

做什么:决定 coolwsd 与客户端(浏览器/反代)之间是否 TLS 加密、证书位置与协议下限。预期结果:正确选择「自持证书」或「反代终结」两种生产姿势。

参数默认值说明与实测
ssl.enabletruecoolwsd 自身 TLS 开关。默认开:首次启动自动生成自签证书到 /etc/coolwsd/(cert.pem/key.pem/ca-chain.cert.pem)。实测未改此项时 http:// 访问失败(HTTP 000)、curl -k https:// 返回 200
ssl.terminationfalse声明前置代理已终结 TLS(coolwsd 内部走 http)。反代部署必配,与 enable=false 成对出现
ssl.cert_file_path/etc/coolwsd/cert.pem自持证书路径
ssl.key_file_path/etc/coolwsd/key.pem私钥路径
ssl.ca_file_path/etc/coolwsd/ca-chain.cert.pemCA 链路径
ssl.ssl_verificationfalsecoolwsd 访问外部主机的证书校验。默认 false:自签证书的内网 WOPI 宿主可直连;公网宿主建议 true
ssl.cipher_listALL:!ADH:!LOW:!EXP:!MD5:@STRENGTHOpenSSL 密码套件
ssl.min_protocol_versionTLSv1.2客户端 TLS 下限
ssl.sts.enabledfalseHSTS。官方注释:一旦启用「Cannot be disabled without resetting the browsers」,确认生产就绪再开
ssl.sts.max_age31536000HSTS 有效期(1 年)

⚠️ 注意:官方对 ssl.enable 的注释写明「do not disable for production deployment」——关闭自身 TLS 的前提是必须有反代终结,两者只能选其一,绝不能同时裸 HTTP 上生产。

5.3 存储域 storage(WOPI 白名单与文档加载)

做什么:声明文档从哪来(WOPI 宿主)、谁能连、多大能传。这是 Collabora 安全模型的核心域。预期结果:正确配置 WOPI 白名单,理解 first/groups 两种模式。

参数默认值说明与实测
storage.filesystem@allowfalse允许直接读服务器本地文件路径。默认关,开启有越权读文件风险
storage.wopi@allowtrueWOPI 存储总开关
storage.wopi.max_file_size0(不限)单文档加载大小上限(字节)
storage.wopi.locking.refresh900向存储侧重取锁的间隔秒数(15 分钟),0 关闭
storage.wopi.alias_groups@modefirstWOPI 白名单核心。first=启动后第一个接入的宿主自动成为唯一可信宿主;groups=只信任显式列出的宿主。实测配置白名单后启动日志 dump 出现 alias_groups[@mode]: groups,漏配时该行缺失
storage.wopi.is_legacy_serverfalse兼容需废弃头的老宿主
storage.wopi.access_token.default_lifetime_mins0宿主未给 token 过期时间时按此值处理,0=不过期
storage.wopi.access_token.refresh_timeout_secs60App_TokenExpired 消息后等待刷新秒数,超时文档转只读
storage.wopi.internal_zonefalsediscovery 的 net-zone 用 internal 还是 external
storage.ssl.as_schemetrue存储侧 TLS 跟随 WOPI URI 的 scheme

groups 模式白名单写法(对应生产模板):

<storage desc="Backend storage">
    <wopi desc="Allow/deny wopi storage." allow="true">
        <alias_groups desc="The WOPI hosts that may connect." mode="groups">
            <group>
                <host allow="true">https://cloud.example.com:443</host>
            </group>
            <group>
                <host allow="true">https://other.example.com:443</host>
                <alias desc="regex pattern of aliasname">other\.internal\.lan:443</alias>
            </group>
        </alias_groups>
    </wopi>
</storage>

说明:host 支持正则(点号需转义);alias 用于同一宿主的别名/内网名;多个宿主写多个 <group>。

5.4 文档进程域 per_document(资源与生命周期)

做什么:控制每份文档进程的并发线程、闲置回收、自动保存与资源上限,是内存规划的第一参数域。预期结果:按团队规模设定合理的回收与限额。

参数默认值说明
per_document.max_concurrency4单文档处理线程上限
per_document.idle_timeout_secs3600闲置文档卸载阈值(1 小时)。小内存机器调小到 600 可显著省内存
per_document.idlesave_duration_secs30闲置多少秒后落一次盘(0 关闭)
per_document.autosave_duration_secs300自动保存间隔(5 分钟,0 关闭)
per_document.background_autosavetrue自动保存走后台 fork 进程,避免卡顿
per_document.background_manualsavetrue手动保存同样可后台化
per_document.background_downloadastrue另存/导出走后台进程
per_document.always_save_on_exitfalse最后一人退出时强制保存上传
per_document.limit_virt_mem_mb0(不限)单文档进程虚拟内存上限。防失控文档吃爆内存时可设(如 4096)
per_document.limit_stack_mem_kb8000栈上限
per_document.limit_file_size_mb0单文档进程可写文件大小上限
per_document.limit_num_open_files0打开文件数上限(最低 4096)
per_document.limit_load_secs100文档加载超时秒数
per_document.limit_store_failures5连续保存上传失败次数上限,达到后停止重试
per_document.limit_convert_secs100convert-to 转换超时秒数
per_document.min_time_between_saves_ms500两次落盘最小间隔
per_document.min_time_between_uploads_ms5000两次上传存储最小间隔
per_document.batch_priority5convert-to 批处理优先级(调低防抢占交互会话)
per_document.cleanup(子域)见下坏文档自动清理:interval 10000ms、判定观察期 60s、闲置 300s + 内存超 3072MB 或 CPU 超 85% 判为 bad 并杀 kit 进程

配套的全局资源参数(顶层):

参数默认值说明
memproportion80.0全部进程可消耗内存占总量百分比,超限开始清理闲置文档
num_prespawn_children4预派生待命子进程数,降低首开延迟。实测 --o:num_prespawn_children=2 覆盖后 dump 显示 num_prespawn_children: 2

5.5 日志域 logging(级别与落盘)

做什么:控制日志级别、启动期级别、文件落盘与脱敏。预期结果:日常 warning,排障时按需放大。

参数默认值说明与实测
logging.levelwarning稳态日志级别,0-8 或 none/fatal/critical/error/warning/notice/information/debug/trace
logging.level_startuptrace启动阶段用 trace(问题最多发),启动完成后回落到 level。实测启动日志首行即见「Setting log-level to [trace] and delaying setting to [warning] until after WSD initialization」
logging.disabled_areasSocket,WebSocket,Admin,Pixel高冗余域豁免清单,可再屏蔽 Generic/WOPI/Storage 等
logging.file@enablefalse文件日志开关。默认关(只出 stdout);开启后按 path 落盘,注意 systemd 部署需在 coolwsd.service 的 ReadWritePaths 放行路径且目录对 cool 用户可写
logging.file.path/var/log/coolwsd.log文件日志路径
logging.file.rotationnever轮换策略(Poco FileChannel 语法),生产建议按天轮换
logging.file.purgeAge10 days归档保留期
logging.file.purgeCount10归档份数
logging.anonymize.anonymize_user_datafalse日志中用户名/文件名脱敏(共享日志给第三方前开启)
logging.docstats / userstatsfalse文档/用户级统计日志
logging_ui_cmd.file@enablefalse用户界面命令审计日志(/var/log/coolwsd-ui-cmd.log),需审计时开启

实测行为:启动日志还会打印一份非默认配置 dump(见 3.3),admin_console.password 等敏感项自动 <redacted>。

5.6 安全域 security(隔离与宏)

做什么:进程隔离机制、管理台令牌时效、宏执行与指标端点鉴权。预期结果:保持默认隔离,按需收紧宏策略。

参数默认值说明
security.seccomptrueseccomp 过滤启用失败时是否视为致命错误(保持 true 保证隔离兜底)
security.capabilitiestrue用 capabilities 构建 chroot jail;官方注释说明隔离降级链:mount namespace → coolforkit-caps chroot → landlock,三者皆无则拒绝启动;设 false 则仅 landlock,极端情况无隔离运行
security.jwt_expiry_secs1800管理台 JWT 有效期(30 分钟)
security.enable_macros_executionfalse宏执行总开关(默认全禁)
security.macro_security_level1宏级别:1=Medium(不可信来源执行前确认)、0=Low(全放行,不推荐)。仅当上一参数为 true 时有意义
security.enable_metrics_unauthenticatedfalse/cool/getMetrics 免鉴权开关(保持 false)
security.server_signaturefalseHTTP 响应头是否带服务器签名(默认隐藏指纹)

实测关联:文档进程隔离降级时日志会出现 ERR 级 usernamespace 提示并自动改用 coolforkit-caps(实测该实例服务 healthy、转换接口正常,属降级告警非致命),详见部署篇排障实录。

5.7 界面与视图域 user_interface / per_view / watermark / view_mode

做什么:控制界面形态、打开缩放、视图闲置降级与水印。预期结果:统一团队界面体验、按合规需要加水印。

参数默认值说明
user_interface.modedefaultcompact(紧凑)/ tabbed(页签)/ default(跟随 ui_defaults 自动决定)
user_interface.use_integration_themetrue使用集成方(如 Nextcloud)主题外观
user_interface.smart_zoomtrue文字文档打开时按窗口宽度适配缩放
user_interface.default_zoom100smart_zoom 关闭时的默认缩放(20~400 档位)
per_view.idle_timeout_secs900用户无操作 15 分钟后视图降级(停止推送更新)
per_view.out_of_focus_timeout_secs300页签失焦 5 分钟后降级省带宽
watermark.text空全实例水印文本(配合宿主 per-user 水印做防泄露)
watermark.opacity0.2水印不透明度 0.0~1.0
view_mode.file_extensions空指定扩展名默认只读打开(如 docx|xlsx)

另有 home_mode.enable(默认 false):家庭模式,开启后关闭欢迎/反馈弹窗,代价是并发连接限 20、并发文档限 10——只适用于个人场景。

5.8 集成增强域 languagetool / deepl / ai / zotero / 其他

做什么:外挂语言服务、翻译、AI 助手与文献插件。预期结果:按需启用,注意外发数据的合规边界。

参数默认值说明
languagetool.enabledfalse远程拼写/语法检查(支持自建或云 API)。官方注释特别提示:开启后文档文本会发送给云端 API,注意隐私合规;base_url 示例 https://api.languagetoolplus.com/v2
languagetool.ssl_verificationtrue其 API 的证书校验
deepl.enabledfalseDeepL 翻译菜单项(需 api_url + auth_key)
ai.enabledfalse26.04 新增 AI 助手总开关,支持任意 OpenAI 兼容端点(含本地 Ollama/vLLM);api_url/model/api_key 配套
ai.allow_user_settingstrue允许用户自带 AI 端点;设 false 强制全员用集中配置
ai.deck_budgets.max_slides30AI 生成演示文稿的页数上限(26.04 新增)
zotero.enabletrueZotero 文献插件默认启用
experimental_featurestrue实验特性开关(实测启动日志「Experimental features are enabled」)
allowed_languagesde_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru写作辅助语言清单。官方注释:列表过长拖慢启动;中文场景需补 zh_CN 并保证宿主装了对应字典
remote_font_config.url空远程字体清单 JSON(统一推送品牌字体)
fonts_missing.handlinglog文档字体缺失处理:report/log/both/ignore
extra_export_formats.*false演示文稿额外导出格式(png/gif/svg/tiff 等)展示开关
document_signing.enabletrue文档签名支持(capabilities 中 hasDocumentSigningSupport=true 实测吻合)
wasm.enablefalseWASM 支持(26.04 capabilities 中 hasWASMSupport=false 吻合)

5.9 管理台域 admin_console

做什么:管理控制台开关与认证方式。预期结果:改默认凭据、必要时上 PAM。

参数默认值说明
admin_console.enabletrue控制台总开关(页面 /browser/dist/admin/admin.html)
admin_console.enable_pamfalse用系统 PAM 认证管理员(企业推荐,免明文密码)
admin_console.username / password空内置账号;password 官方已标注 Deprecated,建议 PAM 或 coolconfig 设置(见命令篇)
admin_console.logging.*true管理登录/指标访问/动作审计日志

实测关联:环境变量注入的凭据在该域生效(启动日志 dump 显示 admin_console.username: <redacted>),浏览器登录实测入口为 401 保护的 admin.html。

六、生产配置模板

以下模板面向:8–16GB 内存、NVMe 磁盘、200 人以下团队、Nginx 反代 TLS 终结、Nextcloud/ownCloud 宿主、中英文文档的典型生产场景。只列需要改动的项,其余保持默认:

<!-- /etc/coolwsd/coolwsd.xml 生产改动项(其余节点保持 26.04.5.1 默认值) -->
<config>
    <!-- 1. 语言:补中文写作辅助(需服务器已装 zh_CN 字典),精简默认列表加快启动 -->
    <allowed_languages default="de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru">en_GB en_US zh_CN</allowed_languages>

    <!-- 2. 网络:仅本机监听,全部流量经反代进入 -->
    <net desc="Network settings">
      <proto type="string" default="all" desc="Protocol to use IPv4, IPv6 or all for both">all</proto>
      <listen type="string" default="any" desc="Listen address that coolwsd binds to. Can be 'any' or 'loopback'.">loopback</listen>
      <content_security_policy desc="Customize the CSP header by specifying one or more policy-directive, separated by semicolons.">frame-ancestors https://cloud.example.com</content_security_policy>
    </net>

    <!-- 3. TLS:反代终结(Nginx 持证书),本体走 HTTP -->
    <ssl desc="SSL settings">
        <enable type="bool" default="true">false</enable>
        <termination type="bool" default="false">true</termination>
        <ssl_verification type="string" default="false">true</ssl_verification>
    </ssl>

    <!-- 4. WOPI 白名单:groups 模式显式列宿主 -->
    <storage desc="Backend storage">
        <wopi desc="Allow/deny wopi storage." allow="true">
            <max_file_size desc="Maximum document size in bytes to load. 0 for unlimited." type="uint">209715200</max_file_size>
            <alias_groups desc="The WOPI hosts that may connect." mode="groups">
                <group>
                    <host allow="true">https://cloud.example.com:443</host>
                </group>
            </alias_groups>
        </wopi>
    </storage>

    <!-- 5. 资源:8GB 内存机器的稳妥配额 -->
    <memproportion desc="The maximum percentage of available memory consumed" type="double" default="80.0">70.0</memproportion>
    <num_prespawn_children desc="Number of child processes to keep started in advance." type="uint" default="4">2</num_prespawn_children>
    <per_document desc="Document-specific settings, including LO Core settings.">
        <idle_timeout_secs desc="The maximum number of seconds before unloading an idle document." type="uint" default="3600">900</idle_timeout_secs>
        <limit_virt_mem_mb desc="The maximum virtual memory allowed to each document process. 0 for unlimited." type="uint">4096</limit_virt_mem_mb>
    </per_document>

    <!-- 6. 日志:文件落盘 + 按天轮换 -->
    <logging>
        <level type="string" default="warning">warning</level>
        <file enable="true">
            <property name="path" desc="Log file path.">/var/log/coolwsd.log</property>
            <property name="rotation" desc="Log file rotation strategy. See Poco FileChannel.">daily</property>
            <property name="purgeAge" desc="The maximum age of log files to preserve.">30 days</property>
            <property name="purgeCount" desc="The maximum number of log archives to preserve.">14</property>
            <property name="flush" desc="Enable/disable flushing after logging each line.">false</property>
        </file>
    </logging>

    <!-- 7. 安全:宏保持禁用;CSP 已在 net 域声明宿主嵌入 -->
    <security desc="Altering these defaults potentially opens you to significant risk">
        <enable_macros_execution type="bool" default="false">false</enable_macros_execution>
    </security>

    <!-- 8. 界面:统一紧凑形态 -->
    <user_interface>
        <mode type="string" default="default">compact</mode>
    </user_interface>
</config>

模板逐项解读:

  • 语言:26.04 默认 9 种欧洲语言全开会拖慢启动(官方注释明确),生产只留实际需要的语言;zh_CN 需要系统已安装中文写作辅助字典,缺失时拼写检查对中文无效但文档可正常编辑。
  • net.listen=loopback:coolwsd 只听 127.0.0.1:9980,外部必须经 Nginx 进入,杜绝绕过反代直连 9980 的口子。
  • CSP frame-ancestors:只允许 Nextcloud 站点嵌入 iframe,防点击劫持与任意站点嵌用。
  • ssl.enable=false + termination=true:与 Nginx 443 TLS 终结对成对;ssl_verification=true 让 coolwsd 校验宿主证书(宿主走公网证书时开启)。
  • max_file_size=209715200:单文档上限 200MB,防超大文档拖垮 kit 进程;按业务调整。
  • memproportion=70 + num_prespawn_children=2 + idle_timeout_secs=900:8GB 内存下给系统与其他服务留余量;15 分钟无人编辑即卸载文档进程,是内存回收的主杠杆。
  • limit_virt_mem_mb=4096:单文档进程 4GB 虚拟内存上限,防失控文档;触发上限的文档会被终止,配合 cleanup 子域自动清理。
  • 文件日志:/var/log/coolwsd.log 按天轮换保留 30 天/14 份;systemd 部署记得在 unit 的 ReadWritePaths 放行 /var/log(官方配置文件注释原文要求)。
  • 适用性:16GB 以上机器可把 memproportion 回到 80、num_prespawn_children 回到 4;百人以上并发或重表格场景,优先扩内存而非调大 limit(LibreOffice 引擎内存消耗与文档复杂度强相关)。

配置完成后重启并验证:

systemctl restart coolwsd
journalctl -u coolwsd --no-pager | grep -E 'alias_groups|num_prespawn|memproportion'
curl -s http://localhost:9980/hosting/capabilities | head -c 100; echo

预期:dump 行显示改后值;capabilities 返回 JSON(服务健康)。本文实测环境中同款改动经启动日志 dump 验证生效(num_prespawn_children: 2、alias_groups[@mode]: groups)。

七、常见问题

Q1:改了配置不生效? 按优先级排查:命令行 --o: 参数 > coolwsd.xml > 默认值——先用启动日志的 non-default dump 确认最终值(3.3 节),再确认是否忘了 systemctl restart coolwsd,最后检查 XML 是否改错了节点文本值(default 属性只是注释,真正的值是元素文本)。

Q2:启动日志出现 usernamespace failed 是不是坏了? 不是致命错误。这是隔离方式降级(改用 coolforkit-caps chroot),实测该实例服务 healthy、convert-to 转换正常(部署篇排障实录三)。需要最高隔离等级时确保内核开启 user namespace。

Q3:白名单配置了宿主还是被拒? 三点检查:① 正则点号必须转义(cloud\.example\.com);② 生成配置的 alias_groups@mode 必须是 groups(dump 核对);③ 若同时存在环境变量注入与文件配置两处白名单,以命令行(环境变量生成)为准,二选一配置。

Q4:中文文档显示方块/字体退化? 服务器缺中文字体。安装字体包(如 fonts-noto-cjk)后重启 coolwsd;也可用 remote_font_config.url 统一分发字体清单。

Q5:想临时提高日志排一个协同问题? --o:logging.level=information(或 debug/trace)重启复现,结束后改回 warning;注意 disabled_areas 默认屏蔽 Socket/WebSocket/Admin/Pixel 的高冗余日志,追协议级问题时临时清空该列表。

八、参考链接