# Nextcloud 启用 Collabora Office

TIP

  • Collabora Office 是以 Docker 方式运行的
  • 使用 Collabora Office 必须要其和 Nextcloud 配置 TLS 证书
  • 需要为 Collabora Office 准备一个(二级)域名

# 安装Docker

apt install docker.io
  • 获取 Collabora Office 并在后台启动
docker run -t -d -p 9980:9980 -e "domain=example.com" --cap-add MKNOD collabora/code
  • 9980:9980是指你需要给 Collabora Office 分配一个监听的端口,可以任意
  • example.com 是指绑定你 Nextcloud 所在的域名

Nginx 文件配置示例

server {
    listen  443 ssl;
    server_name example.com;

    ssl_certificate /path/to/certficate;
    ssl_certificate_key /path/to/key;

    # static files
    location ^~ /loleaflet {
        proxy_pass https://localhost:9980;
        proxy_set_header Host $http_host;
    }

    # WOPI discovery URL
    location ^~ /hosting/discovery {
        proxy_pass https://localhost:9980;
        proxy_set_header Host $http_host;
    }

   # main websocket
   location ~ ^/lool/(.*)/ws$ {
       proxy_pass https://localhost:9980;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "Upgrade";
       proxy_set_header Host $http_host;
       proxy_read_timeout 36000s;
   }

   # download, presentation and image upload
   location ~ ^/lool {
       proxy_pass https://localhost:9980;
       proxy_set_header Host $http_host;
   }

   # Admin Console websocket
   location ^~ /lool/adminws {
       proxy_pass https://localhost:9980;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "Upgrade";
       proxy_set_header Host $http_host;
       proxy_read_timeout 36000s;
   }
}

重启 Nginx 服务

systemctl restart nginx

安装 Nextcloud 应用程序

  1. 应用 > Office & text > Collabora Online
  2. 设置 > 在线协作 你的office所在域名

文章部分内容转载链接: